@react-native-community/template 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/package.json +19 -0
  4. package/template/App.tsx +118 -0
  5. package/template/Gemfile +9 -0
  6. package/template/README.md +79 -0
  7. package/template/__tests__/App.test.tsx +17 -0
  8. package/template/_bundle/config +2 -0
  9. package/template/_eslintrc.js +4 -0
  10. package/template/_gitignore +74 -0
  11. package/template/_prettierrc.js +7 -0
  12. package/template/_watchmanconfig +1 -0
  13. package/template/android/app/build.gradle +119 -0
  14. package/template/android/app/debug.keystore +0 -0
  15. package/template/android/app/proguard-rules.pro +10 -0
  16. package/template/android/app/src/debug/AndroidManifest.xml +9 -0
  17. package/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java +75 -0
  18. package/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.kt +54 -0
  19. package/template/android/app/src/main/AndroidManifest.xml +25 -0
  20. package/template/android/app/src/main/java/com/helloworld/MainActivity.java +32 -0
  21. package/template/android/app/src/main/java/com/helloworld/MainActivity.kt +22 -0
  22. package/template/android/app/src/main/java/com/helloworld/MainApplication.java +62 -0
  23. package/template/android/app/src/main/java/com/helloworld/MainApplication.kt +43 -0
  24. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  25. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  26. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  27. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  28. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  29. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  30. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  31. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  32. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  33. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  34. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  35. package/template/android/app/src/main/res/values/strings.xml +3 -0
  36. package/template/android/app/src/main/res/values/styles.xml +9 -0
  37. package/template/android/app/src/release/java/com/helloworld/ReactNativeFlipper.java +20 -0
  38. package/template/android/app/src/release/java/com/helloworld/ReactNativeFlipper.kt +15 -0
  39. package/template/android/build.gradle +21 -0
  40. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  41. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  42. package/template/android/gradle-wrapper.jar +0 -0
  43. package/template/android/gradle-wrapper.properties +7 -0
  44. package/template/android/gradle.properties +39 -0
  45. package/template/android/gradlew +249 -0
  46. package/template/android/gradlew.bat +92 -0
  47. package/template/android/settings.gradle +6 -0
  48. package/template/app.json +4 -0
  49. package/template/babel.config.js +3 -0
  50. package/template/index.js +9 -0
  51. package/template/ios/HelloWorld/AppDelegate.h +6 -0
  52. package/template/ios/HelloWorld/AppDelegate.mm +31 -0
  53. package/template/ios/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  54. package/template/ios/HelloWorld/Images.xcassets/Contents.json +6 -0
  55. package/template/ios/HelloWorld/Info.plist +52 -0
  56. package/template/ios/HelloWorld/LaunchScreen.storyboard +47 -0
  57. package/template/ios/HelloWorld/main.m +10 -0
  58. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +686 -0
  59. package/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme +88 -0
  60. package/template/ios/HelloWorldTests/HelloWorldTests.m +66 -0
  61. package/template/ios/HelloWorldTests/Info.plist +24 -0
  62. package/template/ios/Podfile +40 -0
  63. package/template/ios/_xcode.env +11 -0
  64. package/template/jest.config.js +3 -0
  65. package/template/metro.config.js +11 -0
  66. package/template/package.json +37 -0
  67. package/template/template/App.tsx +118 -0
  68. package/template/template/Gemfile +8 -0
  69. package/template/template/README.md +79 -0
  70. package/template/template/__tests__/App.test.tsx +17 -0
  71. package/template/template/_bundle/config +2 -0
  72. package/template/template/_eslintrc.js +4 -0
  73. package/template/template/_gitignore +74 -0
  74. package/template/template/_prettierrc.js +7 -0
  75. package/template/template/_watchmanconfig +1 -0
  76. package/template/template/android/app/build.gradle +118 -0
  77. package/template/template/android/app/debug.keystore +0 -0
  78. package/template/template/android/app/proguard-rules.pro +10 -0
  79. package/template/template/android/app/src/debug/AndroidManifest.xml +9 -0
  80. package/template/template/android/app/src/main/AndroidManifest.xml +26 -0
  81. package/template/template/android/app/src/main/java/com/helloworld/MainActivity.kt +22 -0
  82. package/template/template/android/app/src/main/java/com/helloworld/MainApplication.kt +43 -0
  83. package/template/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  84. package/template/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  85. package/template/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  86. package/template/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  87. package/template/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  88. package/template/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  89. package/template/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  90. package/template/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  91. package/template/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  92. package/template/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  93. package/template/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  94. package/template/template/android/app/src/main/res/values/strings.xml +3 -0
  95. package/template/template/android/app/src/main/res/values/styles.xml +9 -0
  96. package/template/template/android/build.gradle +21 -0
  97. package/template/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  98. package/template/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  99. package/template/template/android/gradle.properties +41 -0
  100. package/template/template/android/gradlew +249 -0
  101. package/template/template/android/gradlew.bat +92 -0
  102. package/template/template/android/settings.gradle +4 -0
  103. package/template/template/app.json +4 -0
  104. package/template/template/babel.config.js +3 -0
  105. package/template/template/index.js +9 -0
  106. package/template/template/ios/HelloWorld/AppDelegate.h +6 -0
  107. package/template/template/ios/HelloWorld/AppDelegate.mm +31 -0
  108. package/template/template/ios/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  109. package/template/template/ios/HelloWorld/Images.xcassets/Contents.json +6 -0
  110. package/template/template/ios/HelloWorld/Info.plist +52 -0
  111. package/template/template/ios/HelloWorld/LaunchScreen.storyboard +47 -0
  112. package/template/template/ios/HelloWorld/PrivacyInfo.xcprivacy +38 -0
  113. package/template/template/ios/HelloWorld/main.m +10 -0
  114. package/template/template/ios/HelloWorld.xcodeproj/project.pbxproj +688 -0
  115. package/template/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme +88 -0
  116. package/template/template/ios/HelloWorldTests/HelloWorldTests.m +66 -0
  117. package/template/template/ios/HelloWorldTests/Info.plist +24 -0
  118. package/template/template/ios/Podfile +40 -0
  119. package/template/template/ios/_xcode.env +11 -0
  120. package/template/template/jest.config.js +3 -0
  121. package/template/template/metro.config.js +11 -0
  122. package/template/template/package.json +36 -0
  123. package/template/template/tsconfig.json +3 -0
  124. package/template/tsconfig.json +3 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 react-native-community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # React Native Community Template
2
+
3
+ The template used by `npx @react-native-community/cli init` to bootstrap a React Native application.
4
+
5
+ [![Build Status][build-badge]][build] [![Version][version-badge]][package] [![MIT License][license-badge]][license] [![PRs Welcome][prs-welcome-badge]][prs-welcome]
6
+
7
+
8
+ ## Contents
9
+
10
+ - [About](#about)
11
+ - [License](#license)
12
+
13
+ ## About
14
+
15
+ This repository contains the template used by the React Native Community's Command Line Tool (or CLI) to bootstrap a React Native project.
16
+
17
+ ## License
18
+
19
+ Everything inside this repository is [MIT licensed](./LICENSE).
20
+
21
+ <!-- badges -->
22
+
23
+ [build-badge]: https://img.shields.io/github/actions/workflow/status/react-native-community/template/test.yml?branch=main&style=flat-square
24
+ [build]: https://github.com/react-native-community/template/actions/workflows/test.yml
25
+ [version-badge]: https://img.shields.io/npm/v/@react-native-community/template.svg?style=flat-square
26
+ [package]: https://www.npmjs.com/package/@react-native-community/template
27
+ [license-badge]: https://img.shields.io/npm/l/@react-native-community/template.svg?style=flat-square
28
+ [license]: https://opensource.org/licenses/MIT
29
+ [prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
30
+ [prs-welcome]: http://makeapullrequest.com
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@react-native-community/template",
3
+ "version": "0.0.1",
4
+ "description": "The template used by `npx @react-native-community/cli init` to bootstrap a React Native application.",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "files": [
10
+ "template/*"
11
+ ],
12
+ "dependencies": {},
13
+ "devDependencies": {},
14
+ "homepage": "https://github.com/react-native-community/template/tree/main",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/react-native-community/template.git"
18
+ }
19
+ }
@@ -0,0 +1,118 @@
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
+ View,
18
+ } from 'react-native';
19
+
20
+ import {
21
+ Colors,
22
+ DebugInstructions,
23
+ Header,
24
+ LearnMoreLinks,
25
+ ReloadInstructions,
26
+ } from 'react-native/Libraries/NewAppScreen';
27
+
28
+ type SectionProps = PropsWithChildren<{
29
+ title: string;
30
+ }>;
31
+
32
+ function Section({children, title}: SectionProps): React.JSX.Element {
33
+ const isDarkMode = useColorScheme() === 'dark';
34
+ return (
35
+ <View style={styles.sectionContainer}>
36
+ <Text
37
+ style={[
38
+ styles.sectionTitle,
39
+ {
40
+ color: isDarkMode ? Colors.white : Colors.black,
41
+ },
42
+ ]}>
43
+ {title}
44
+ </Text>
45
+ <Text
46
+ style={[
47
+ styles.sectionDescription,
48
+ {
49
+ color: isDarkMode ? Colors.light : Colors.dark,
50
+ },
51
+ ]}>
52
+ {children}
53
+ </Text>
54
+ </View>
55
+ );
56
+ }
57
+
58
+ function App(): React.JSX.Element {
59
+ const isDarkMode = useColorScheme() === 'dark';
60
+
61
+ const backgroundStyle = {
62
+ backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
63
+ };
64
+
65
+ return (
66
+ <SafeAreaView style={backgroundStyle}>
67
+ <StatusBar
68
+ barStyle={isDarkMode ? 'light-content' : 'dark-content'}
69
+ backgroundColor={backgroundStyle.backgroundColor}
70
+ />
71
+ <ScrollView
72
+ contentInsetAdjustmentBehavior="automatic"
73
+ style={backgroundStyle}>
74
+ <Header />
75
+ <View
76
+ style={{
77
+ backgroundColor: isDarkMode ? Colors.black : Colors.white,
78
+ }}>
79
+ <Section title="Step One">
80
+ Edit <Text style={styles.highlight}>App.tsx</Text> to change this
81
+ screen and then come back to see your edits.
82
+ </Section>
83
+ <Section title="See Your Changes">
84
+ <ReloadInstructions />
85
+ </Section>
86
+ <Section title="Debug">
87
+ <DebugInstructions />
88
+ </Section>
89
+ <Section title="Learn More">
90
+ Read the docs to discover what to do next:
91
+ </Section>
92
+ <LearnMoreLinks />
93
+ </View>
94
+ </ScrollView>
95
+ </SafeAreaView>
96
+ );
97
+ }
98
+
99
+ const styles = StyleSheet.create({
100
+ sectionContainer: {
101
+ marginTop: 32,
102
+ paddingHorizontal: 24,
103
+ },
104
+ sectionTitle: {
105
+ fontSize: 24,
106
+ fontWeight: '600',
107
+ },
108
+ sectionDescription: {
109
+ marginTop: 8,
110
+ fontSize: 18,
111
+ fontWeight: '400',
112
+ },
113
+ highlight: {
114
+ fontWeight: '700',
115
+ },
116
+ });
117
+
118
+ export default App;
@@ -0,0 +1,9 @@
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 ">= 2.6.10"
5
+
6
+ # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7
+ # bound in the template on Cocoapods with next React Native release.
8
+ gem 'cocoapods', '>= 1.13', '< 1.15'
9
+ gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
@@ -0,0 +1,79 @@
1
+ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2
+
3
+ # Getting Started
4
+
5
+ >**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6
+
7
+ ## Step 1: Start the Metro Server
8
+
9
+ First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10
+
11
+ To start Metro, run the following command from the _root_ of your React Native project:
12
+
13
+ ```bash
14
+ # using npm
15
+ npm start
16
+
17
+ # OR using Yarn
18
+ yarn start
19
+ ```
20
+
21
+ ## Step 2: Start your Application
22
+
23
+ Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24
+
25
+ ### For Android
26
+
27
+ ```bash
28
+ # using npm
29
+ npm run android
30
+
31
+ # OR using Yarn
32
+ yarn android
33
+ ```
34
+
35
+ ### For iOS
36
+
37
+ ```bash
38
+ # using npm
39
+ npm run ios
40
+
41
+ # OR using Yarn
42
+ yarn ios
43
+ ```
44
+
45
+ If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46
+
47
+ This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48
+
49
+ ## Step 3: Modifying your App
50
+
51
+ Now that you have successfully run the app, let's modify it.
52
+
53
+ 1. Open `App.tsx` in your text editor of choice and edit some lines.
54
+ 2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
55
+
56
+ For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
57
+
58
+ ## Congratulations! :tada:
59
+
60
+ You've successfully run and modified your React Native App. :partying_face:
61
+
62
+ ### Now what?
63
+
64
+ - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65
+ - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66
+
67
+ # Troubleshooting
68
+
69
+ If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70
+
71
+ # Learn More
72
+
73
+ To learn more about React Native, take a look at the following resources:
74
+
75
+ - [React Native Website](https://reactnative.dev) - learn more about React Native.
76
+ - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77
+ - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78
+ - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79
+ - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @format
3
+ */
4
+
5
+ import 'react-native';
6
+ import React from 'react';
7
+ import App from '../App';
8
+
9
+ // Note: import explicitly to use the types shipped with jest.
10
+ import {it} from '@jest/globals';
11
+
12
+ // Note: test renderer must be required after react-native.
13
+ import renderer from 'react-test-renderer';
14
+
15
+ it('renders correctly', () => {
16
+ renderer.create(<App />);
17
+ });
@@ -0,0 +1,2 @@
1
+ BUNDLE_PATH: "vendor/bundle"
2
+ BUNDLE_FORCE_RUBY_PLATFORM: 1
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@react-native',
4
+ };
@@ -0,0 +1,74 @@
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
+ **/.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
+ **/Pods/
60
+ /vendor/bundle/
61
+
62
+ # Temporary files created by Metro to check the health of the file watcher
63
+ .metro-health-check*
64
+
65
+ # testing
66
+ /coverage
67
+
68
+ # Yarn
69
+ .yarn/*
70
+ !.yarn/patches
71
+ !.yarn/plugins
72
+ !.yarn/releases
73
+ !.yarn/sdks
74
+ !.yarn/versions
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ bracketSameLine: true,
4
+ bracketSpacing: false,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ };
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,119 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '..'
12
+ // root = file("../")
13
+ // The folder where the react-native NPM package is. Default is ../node_modules/react-native
14
+ // reactNativeDir = file("../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16
+ // codegenDir = file("../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18
+ // cliFile = file("../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
56
+
57
+ /**
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
+ */
60
+ def enableProguardInReleaseBuilds = false
61
+
62
+ /**
63
+ * The preferred build flavor of JavaScriptCore (JSC)
64
+ *
65
+ * For example, to use the international variant, you can use:
66
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
67
+ *
68
+ * The international variant includes ICU i18n library and necessary data
69
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
+ * give correct results when using with locales other than en-US. Note that
71
+ * this variant is about 6MiB larger per architecture than default.
72
+ */
73
+ def jscFlavor = 'org.webkit:android-jsc:+'
74
+
75
+ android {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
79
+
80
+ namespace "com.helloworld"
81
+ defaultConfig {
82
+ applicationId "com.helloworld"
83
+ minSdkVersion rootProject.ext.minSdkVersion
84
+ targetSdkVersion rootProject.ext.targetSdkVersion
85
+ versionCode 1
86
+ versionName "1.0"
87
+ }
88
+ signingConfigs {
89
+ debug {
90
+ storeFile file('debug.keystore')
91
+ storePassword 'android'
92
+ keyAlias 'androiddebugkey'
93
+ keyPassword 'android'
94
+ }
95
+ }
96
+ buildTypes {
97
+ debug {
98
+ signingConfig signingConfigs.debug
99
+ }
100
+ release {
101
+ // Caution! In production, you need to generate your own keystore file.
102
+ // see https://reactnative.dev/docs/signed-apk-android.
103
+ signingConfig signingConfigs.debug
104
+ minifyEnabled enableProguardInReleaseBuilds
105
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106
+ }
107
+ }
108
+ }
109
+
110
+ dependencies {
111
+ // The version of react-native is set by the React Native Gradle Plugin
112
+ implementation("com.facebook.react:react-android")
113
+
114
+ if (hermesEnabled.toBoolean()) {
115
+ implementation("com.facebook.react:hermes-android")
116
+ } else {
117
+ implementation jscFlavor
118
+ }
119
+ }
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <application
6
+ android:usesCleartextTraffic="true"
7
+ tools:targetApi="28"
8
+ tools:ignore="GoogleAppIndexingWarning"/>
9
+ </manifest>
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5
+ * directory of this source tree.
6
+ */
7
+ package com.helloworld;
8
+
9
+ import android.content.Context;
10
+ import com.facebook.flipper.android.AndroidFlipperClient;
11
+ import com.facebook.flipper.android.utils.FlipperUtils;
12
+ import com.facebook.flipper.core.FlipperClient;
13
+ import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14
+ import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15
+ import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16
+ import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17
+ import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18
+ import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19
+ import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20
+ import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21
+ import com.facebook.react.ReactInstanceEventListener;
22
+ import com.facebook.react.ReactInstanceManager;
23
+ import com.facebook.react.bridge.ReactContext;
24
+ import com.facebook.react.modules.network.NetworkingModule;
25
+ import okhttp3.OkHttpClient;
26
+
27
+ /**
28
+ * Class responsible of loading Flipper inside your React Native application. This is the debug
29
+ * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30
+ */
31
+ public class ReactNativeFlipper {
32
+ public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33
+ if (FlipperUtils.shouldEnableFlipper(context)) {
34
+ final FlipperClient client = AndroidFlipperClient.getInstance(context);
35
+
36
+ client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37
+ client.addPlugin(new DatabasesFlipperPlugin(context));
38
+ client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39
+ client.addPlugin(CrashReporterPlugin.getInstance());
40
+
41
+ NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42
+ NetworkingModule.setCustomClientBuilder(
43
+ new NetworkingModule.CustomClientBuilder() {
44
+ @Override
45
+ public void apply(OkHttpClient.Builder builder) {
46
+ builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47
+ }
48
+ });
49
+ client.addPlugin(networkFlipperPlugin);
50
+ client.start();
51
+
52
+ // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53
+ // Hence we run if after all native modules have been initialized
54
+ ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55
+ if (reactContext == null) {
56
+ reactInstanceManager.addReactInstanceEventListener(
57
+ new ReactInstanceEventListener() {
58
+ @Override
59
+ public void onReactContextInitialized(ReactContext reactContext) {
60
+ reactInstanceManager.removeReactInstanceEventListener(this);
61
+ reactContext.runOnNativeModulesQueueThread(
62
+ new Runnable() {
63
+ @Override
64
+ public void run() {
65
+ client.addPlugin(new FrescoFlipperPlugin());
66
+ }
67
+ });
68
+ }
69
+ });
70
+ } else {
71
+ client.addPlugin(new FrescoFlipperPlugin());
72
+ }
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,54 @@
1
+ package com.helloworld
2
+
3
+ import android.content.Context
4
+ import com.facebook.flipper.android.AndroidFlipperClient
5
+ import com.facebook.flipper.android.utils.FlipperUtils
6
+ import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin
7
+ import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin
8
+ import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin
9
+ import com.facebook.flipper.plugins.inspector.DescriptorMapping
10
+ import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
11
+ import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor
12
+ import com.facebook.flipper.plugins.network.NetworkFlipperPlugin
13
+ import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
14
+ import com.facebook.react.ReactInstanceEventListener
15
+ import com.facebook.react.ReactInstanceManager
16
+ import com.facebook.react.bridge.ReactContext
17
+ import com.facebook.react.modules.network.NetworkingModule
18
+
19
+ /**
20
+ * Class responsible of loading Flipper inside your React Native application. This is the debug
21
+ * flavor of it. Here you can add your own plugins and customize the Flipper setup.
22
+ */
23
+ object ReactNativeFlipper {
24
+ fun initializeFlipper(context: Context, reactInstanceManager: ReactInstanceManager) {
25
+ if (FlipperUtils.shouldEnableFlipper(context)) {
26
+ val client = AndroidFlipperClient.getInstance(context)
27
+ client.addPlugin(InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()))
28
+ client.addPlugin(DatabasesFlipperPlugin(context))
29
+ client.addPlugin(SharedPreferencesFlipperPlugin(context))
30
+ client.addPlugin(CrashReporterPlugin.getInstance())
31
+ val networkFlipperPlugin = NetworkFlipperPlugin()
32
+ NetworkingModule.setCustomClientBuilder { builder ->
33
+ builder.addNetworkInterceptor(FlipperOkhttpInterceptor(networkFlipperPlugin))
34
+ }
35
+ client.addPlugin(networkFlipperPlugin)
36
+ client.start()
37
+
38
+ // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
39
+ // Hence we run if after all native modules have been initialized
40
+ val currentReactContext = reactInstanceManager.currentReactContext
41
+ if (currentReactContext == null) {
42
+ reactInstanceManager.addReactInstanceEventListener(
43
+ object : ReactInstanceEventListener {
44
+ override fun onReactContextInitialized(context: ReactContext) {
45
+ reactInstanceManager.removeReactInstanceEventListener(this)
46
+ context.runOnNativeModulesQueueThread { client.addPlugin(FrescoFlipperPlugin()) }
47
+ }
48
+ })
49
+ } else {
50
+ client.addPlugin(FrescoFlipperPlugin())
51
+ }
52
+ }
53
+ }
54
+ }