Skip to content

Commit e2fb46c

Browse files
author
Pritish
committed
first commit
0 parents  commit e2fb46c

File tree

79 files changed

+10661
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+10661
-0
lines changed

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

.gitignore

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
ios/.xcode.env.local
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
42+
43+
# fastlane
44+
#
45+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46+
# screenshots whenever they are needed.
47+
# For more information about the recommended setup visit:
48+
# https://docs.fastlane.tools/best-practices/source-control/
49+
50+
**/fastlane/report.xml
51+
**/fastlane/Preview.html
52+
**/fastlane/screenshots
53+
**/fastlane/test_output
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# Ruby / CocoaPods
59+
/ios/Pods/
60+
/vendor/bundle/
61+
62+
# Temporary files created by Metro to check the health of the file watcher
63+
.metro-health-check*

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.6

.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

App.tsx

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import React from 'react';
9+
import type {PropsWithChildren} from 'react';
10+
import {
11+
SafeAreaView,
12+
ScrollView,
13+
StatusBar,
14+
StyleSheet,
15+
Text,
16+
useColorScheme,
17+
useWindowDimensions,
18+
View,
19+
} from 'react-native';
20+
21+
import {
22+
Colors,
23+
DebugInstructions,
24+
Header,
25+
LearnMoreLinks,
26+
ReloadInstructions,
27+
} from 'react-native/Libraries/NewAppScreen';
28+
import RTNMyDateView from 'rtn-my-date-view/js/RTNMyDateViewNativeComponent';
29+
30+
function App(): JSX.Element {
31+
const isDarkMode = useColorScheme() === 'dark';
32+
33+
const backgroundStyle = {
34+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
35+
};
36+
37+
const {width} = useWindowDimensions();
38+
39+
return (
40+
<SafeAreaView style={backgroundStyle}>
41+
<StatusBar
42+
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
43+
backgroundColor={backgroundStyle.backgroundColor}
44+
/>
45+
46+
<RTNMyDateView
47+
style={{
48+
height: 200,
49+
width,
50+
margin: 20,
51+
}}
52+
onDatePicked={(value: any) => {
53+
console.log(value.nativeEvent.value);
54+
}}
55+
/>
56+
</SafeAreaView>
57+
);
58+
}
59+
60+
export default App;
61+
62+
//yarn add ./RTNMyDateView
63+
64+
//node rnappdate/node_modules/react-native/scripts/generate-codegen-artifacts.js \
65+
// --path rnappdate/ \
66+
// --outputPath rnappdate/RTNMyDateView/generated/

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby File.read(File.join(__dir__, '.ruby-version')).strip
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.3'

Gemfile.lock

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.6)
5+
rexml
6+
activesupport (6.1.7.2)
7+
concurrent-ruby (~> 1.0, >= 1.0.2)
8+
i18n (>= 1.6, < 2)
9+
minitest (>= 5.1)
10+
tzinfo (~> 2.0)
11+
zeitwerk (~> 2.3)
12+
addressable (2.8.1)
13+
public_suffix (>= 2.0.2, < 6.0)
14+
algoliasearch (1.27.5)
15+
httpclient (~> 2.8, >= 2.8.3)
16+
json (>= 1.5.1)
17+
atomos (0.1.3)
18+
claide (1.1.0)
19+
cocoapods (1.11.3)
20+
addressable (~> 2.8)
21+
claide (>= 1.0.2, < 2.0)
22+
cocoapods-core (= 1.11.3)
23+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
24+
cocoapods-downloader (>= 1.4.0, < 2.0)
25+
cocoapods-plugins (>= 1.0.0, < 2.0)
26+
cocoapods-search (>= 1.0.0, < 2.0)
27+
cocoapods-trunk (>= 1.4.0, < 2.0)
28+
cocoapods-try (>= 1.1.0, < 2.0)
29+
colored2 (~> 3.1)
30+
escape (~> 0.0.4)
31+
fourflusher (>= 2.3.0, < 3.0)
32+
gh_inspector (~> 1.0)
33+
molinillo (~> 0.8.0)
34+
nap (~> 1.0)
35+
ruby-macho (>= 1.0, < 3.0)
36+
xcodeproj (>= 1.21.0, < 2.0)
37+
cocoapods-core (1.11.3)
38+
activesupport (>= 5.0, < 7)
39+
addressable (~> 2.8)
40+
algoliasearch (~> 1.0)
41+
concurrent-ruby (~> 1.1)
42+
fuzzy_match (~> 2.0.4)
43+
nap (~> 1.0)
44+
netrc (~> 0.11)
45+
public_suffix (~> 4.0)
46+
typhoeus (~> 1.0)
47+
cocoapods-deintegrate (1.0.5)
48+
cocoapods-downloader (1.6.3)
49+
cocoapods-plugins (1.0.0)
50+
nap
51+
cocoapods-search (1.0.1)
52+
cocoapods-trunk (1.6.0)
53+
nap (>= 0.8, < 2.0)
54+
netrc (~> 0.11)
55+
cocoapods-try (1.2.0)
56+
colored2 (3.1.2)
57+
concurrent-ruby (1.2.0)
58+
escape (0.0.4)
59+
ethon (0.16.0)
60+
ffi (>= 1.15.0)
61+
ffi (1.15.5)
62+
fourflusher (2.3.1)
63+
fuzzy_match (2.0.4)
64+
gh_inspector (1.1.3)
65+
httpclient (2.8.3)
66+
i18n (1.12.0)
67+
concurrent-ruby (~> 1.0)
68+
json (2.6.3)
69+
minitest (5.17.0)
70+
molinillo (0.8.0)
71+
nanaimo (0.3.0)
72+
nap (1.1.0)
73+
netrc (0.11.0)
74+
public_suffix (4.0.7)
75+
rexml (3.2.5)
76+
ruby-macho (2.5.1)
77+
typhoeus (1.4.0)
78+
ethon (>= 0.9.0)
79+
tzinfo (2.0.6)
80+
concurrent-ruby (~> 1.0)
81+
xcodeproj (1.22.0)
82+
CFPropertyList (>= 2.3.3, < 4.0)
83+
atomos (~> 0.1.3)
84+
claide (>= 1.0.2, < 2.0)
85+
colored2 (~> 3.1)
86+
nanaimo (~> 0.3.0)
87+
rexml (~> 3.2.4)
88+
zeitwerk (2.6.7)
89+
90+
PLATFORMS
91+
x86_64-darwin-22
92+
93+
DEPENDENCIES
94+
cocoapods (~> 1.11, >= 1.11.3)
95+
96+
RUBY VERSION
97+
ruby 2.7.6p219
98+
99+
BUNDLED WITH
100+
2.4.6

RTNMyDateView/android/build.gradle

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
buildscript {
2+
ext.safeExtGet = {prop, fallback ->
3+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
4+
}
5+
repositories {
6+
google()
7+
gradlePluginPortal()
8+
}
9+
dependencies {
10+
classpath("com.android.tools.build:gradle:7.3.1")
11+
}
12+
}
13+
14+
apply plugin: 'com.android.library'
15+
apply plugin: 'com.facebook.react'
16+
apply plugin: 'kotlin-android'
17+
18+
android {
19+
compileSdkVersion safeExtGet('compileSdkVersion', 33)
20+
namespace "com.rtnmydateview"
21+
22+
defaultConfig {
23+
minSdkVersion safeExtGet('minSdkVersion', 21)
24+
targetSdkVersion safeExtGet('targetSdkVersion', 33)
25+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true")
26+
}
27+
}
28+
29+
repositories {
30+
mavenCentral()
31+
google()
32+
}
33+
34+
dependencies {
35+
implementation 'com.facebook.react:react-native'
36+
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.21"
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.rtnmydateview
2+
3+
import android.app.Activity
4+
import android.app.DatePickerDialog
5+
import android.content.Context
6+
import android.view.View
7+
import android.view.ViewGroup
8+
import com.facebook.react.bridge.ReactContext
9+
import com.facebook.react.uimanager.UIManagerHelper
10+
import com.facebook.react.uimanager.events.EventDispatcher
11+
import java.util.*
12+
13+
class MyDateView(context: Context,currentActivity: Activity): View(context) {
14+
private var currentDateTime: Calendar = Calendar.getInstance()
15+
private val mYear = currentDateTime.get(Calendar.YEAR)
16+
private val mMonth = currentDateTime.get(Calendar.MONTH)
17+
private val mDay = currentDateTime.get(Calendar.DAY_OF_MONTH)
18+
var reactContext = getContext() as ReactContext
19+
20+
init {
21+
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
22+
setLayoutParams(layoutParams)
23+
24+
val datePickerDialog = DatePickerDialog(currentActivity,
25+
{ view, year, month, day ->
26+
val monthOfYear = if (month <= 9){
27+
"0$month"
28+
} else {
29+
month
30+
}
31+
val dayOfMonth = if(day <= 9){
32+
"0$day"
33+
} else {
34+
day
35+
}
36+
val eventDispatcher: EventDispatcher? =
37+
UIManagerHelper.getEventDispatcherForReactTag(
38+
reactContext, id
39+
)
40+
eventDispatcher?.dispatchEvent(MyDateViewEvent(id,"$year $monthOfYear $dayOfMonth"))
41+
}, mYear, mMonth, mDay
42+
)
43+
datePickerDialog.show()
44+
}
45+
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.rtnmydateview
2+
3+
import com.facebook.react.bridge.Arguments
4+
import com.facebook.react.bridge.WritableMap
5+
import com.facebook.react.uimanager.events.Event
6+
import com.facebook.react.uimanager.events.RCTModernEventEmitter
7+
8+
class MyDateViewEvent(viewId: Int, private val date: String) :
9+
Event<MyDateViewEvent>(viewId) {
10+
11+
override fun getEventName(): String {
12+
return "topOnDatePicked"
13+
}
14+
15+
override fun dispatchModern(rctEventEmitter: RCTModernEventEmitter?) {
16+
super.dispatchModern(rctEventEmitter)
17+
rctEventEmitter?.receiveEvent(
18+
-1,
19+
viewTag, eventName,
20+
Arguments.createMap()
21+
)
22+
}
23+
24+
override fun getEventData(): WritableMap {
25+
val event: WritableMap = Arguments.createMap()
26+
event.putString("value", date)
27+
return event
28+
}
29+
}

0 commit comments

Comments
 (0)