├── .buckconfig
├── .bundle
└── config
├── .eslintrc.js
├── .gitignore
├── .node-version
├── .npmrc
├── .prettierrc.js
├── .ruby-version
├── .vscode
└── settings.json
├── .watchmanconfig
├── Gemfile
├── README.md
├── __tests__
└── App-test.tsx
├── android
├── app
│ ├── _BUCK
│ ├── build.gradle
│ ├── build_defs.bzl
│ ├── debug.keystore
│ ├── my-release-key.keystore
│ ├── proguard-rules.pro
│ └── src
│ │ ├── debug
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── wowimrn
│ │ │ └── ReactNativeFlipper.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── wowimrn
│ │ │ ├── MainActivity.java
│ │ │ ├── MainApplication.java
│ │ │ ├── RCTButton.java
│ │ │ ├── RCTButtonPackage.java
│ │ │ ├── ToastModule.java
│ │ │ └── newarchitecture
│ │ │ ├── MainApplicationReactNativeHost.java
│ │ │ ├── components
│ │ │ └── MainComponentsRegistry.java
│ │ │ └── modules
│ │ │ └── MainApplicationTurboModuleManagerDelegate.java
│ │ ├── jni
│ │ ├── CMakeLists.txt
│ │ ├── MainApplicationModuleProvider.cpp
│ │ ├── MainApplicationModuleProvider.h
│ │ ├── MainApplicationTurboModuleManagerDelegate.cpp
│ │ ├── MainApplicationTurboModuleManagerDelegate.h
│ │ ├── MainComponentsRegistry.cpp
│ │ ├── MainComponentsRegistry.h
│ │ └── OnLoad.cpp
│ │ └── res
│ │ ├── drawable
│ │ └── rn_edit_text_material.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── app.json
├── babel.config.js
├── docs
├── README.md
└── RNCamera.js
├── fix-camera.sh
├── iconfont.json
├── index.js
├── ios
├── .xcode.env
├── CustomButton.m
├── MyButton.h
├── MyButton.m
├── MyButtonManager.h
├── MyButtonManager.m
├── Podfile
├── Podfile.lock
├── RNTMapManager.m
├── WowImRN.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── WowImRN.xcscheme
├── WowImRN.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── WowImRN
│ ├── AppDelegate.h
│ ├── AppDelegate.mm
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Info.plist
│ ├── LaunchScreen.storyboard
│ └── main.m
└── WowImRNTests
│ ├── Info.plist
│ └── WowImRNTests.m
├── metro.config.js
├── package-lock.json
├── package.json
├── react-native.config.js
├── screenshot
├── animate.gif
├── fs.png
├── full_bg.png
├── home.png
├── login_screen.png
├── me_login.png
├── me_un_login.png
├── scan.png
├── wx.jpeg
└── wx.png
├── src
├── App.tsx
├── assets
│ ├── animation
│ │ ├── ani.json
│ │ └── bounce-fruit.json
│ ├── iconfont
│ │ ├── IconCameraFill.tsx
│ │ ├── IconCart.tsx
│ │ ├── IconCartO.tsx
│ │ ├── IconContact.tsx
│ │ ├── IconContactO.tsx
│ │ ├── IconEye.tsx
│ │ ├── IconFile.tsx
│ │ ├── IconFile1.tsx
│ │ ├── IconHome.tsx
│ │ ├── IconHomeO.tsx
│ │ ├── IconManage.tsx
│ │ ├── IconManageO.tsx
│ │ ├── IconNoEye.tsx
│ │ ├── IconPeople.tsx
│ │ ├── IconPeopleO.tsx
│ │ ├── IconPhotoFill.tsx
│ │ ├── IconPositionFill.tsx
│ │ ├── IconVideoCallFill.tsx
│ │ ├── IconVoiceFill.tsx
│ │ ├── helper.ts
│ │ └── index.tsx
│ └── img
│ │ ├── account.png
│ │ ├── account_o.png
│ │ ├── arrow_left.png
│ │ ├── avatar.png
│ │ ├── cart.png
│ │ ├── cart_o.png
│ │ ├── find.png
│ │ ├── find_o.png
│ │ ├── home.png
│ │ ├── home_o.png
│ │ └── loading.gif
├── baseUI
│ ├── BButton
│ │ └── index.tsx
│ ├── BEmpty
│ │ └── index.tsx
│ ├── BHStack
│ │ └── index.tsx
│ ├── BImagePicker
│ │ └── index.tsx
│ ├── BInput
│ │ └── index.tsx
│ ├── BLine
│ │ └── index.tsx
│ ├── BList
│ │ └── index.tsx
│ ├── BListItem
│ │ └── index.tsx
│ ├── BPage
│ │ ├── BNPage.tsx
│ │ ├── BNavBar.tsx
│ │ └── index.tsx
│ ├── BRefreshControl
│ │ └── index.tsx
│ ├── BRow
│ │ └── index.tsx
│ ├── BSegment
│ │ ├── Item.tsx
│ │ └── index.tsx
│ ├── BShadow
│ │ └── index.tsx
│ ├── BText
│ │ └── index.tsx
│ ├── BTextArea
│ │ └── index.tsx
│ ├── BVStack
│ │ └── index.tsx
│ ├── Loading
│ │ ├── index.tsx
│ │ ├── loading_01.gif
│ │ ├── loading_02.gif
│ │ ├── loading_03.gif
│ │ ├── loading_04.gif
│ │ ├── loading_05.gif
│ │ ├── loading_06.gif
│ │ └── loading_07.gif
│ ├── MTouchableOpacity
│ │ └── index.tsx
│ ├── TabBarIcon
│ │ └── index.tsx
│ └── icon
│ │ ├── IconArrowLeft.tsx
│ │ ├── IconArrowRight.tsx
│ │ ├── IconClose.tsx
│ │ ├── IconIosArrowRoundBack.tsx
│ │ ├── IconKongbai1.tsx
│ │ └── helper.ts
├── config
│ ├── index.ts
│ ├── request.ts
│ └── theme.ts
├── global.d.ts
├── models
│ ├── account.ts
│ ├── contact.ts
│ └── index.ts
├── native
│ └── MyButton.js
├── navigator
│ ├── MainTab.tsx
│ ├── MainTabBar.tsx
│ └── index.tsx
├── pages
│ ├── animate
│ │ └── index.tsx
│ ├── camera
│ │ ├── index.tsx
│ │ └── version-camera.tsx
│ ├── category
│ │ ├── data.json
│ │ └── index.tsx
│ ├── contact
│ │ ├── List.tsx
│ │ ├── data.tsx
│ │ └── index.tsx
│ ├── detail
│ │ └── index.tsx
│ ├── download
│ │ └── index.tsx
│ ├── fs
│ │ └── index.tsx
│ ├── h5
│ │ └── index.tsx
│ ├── home
│ │ └── index.tsx
│ ├── login
│ │ ├── index.tsx
│ │ └── style.ts
│ ├── me
│ │ └── index.tsx
│ └── table
│ │ └── index.tsx
├── plugins
│ ├── notification
│ │ ├── Demo.jsx
│ │ ├── NotifService.js
│ │ └── NotificationHandler.js
│ └── plugin-one
│ │ └── .gitkeep
├── services
│ ├── account.ts
│ └── contact.ts
├── types
│ ├── ResData.ts
│ └── UserInfo.ts
├── utils
│ ├── auth.ts
│ ├── date.ts
│ ├── env.ts
│ ├── logger.ts
│ ├── screen.ts
│ ├── storage.ts
│ └── uuid.ts
└── wrappers
│ └── .gitkeep
├── tsconfig.json
└── yarn.lock
/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/.bundle/config:
--------------------------------------------------------------------------------
1 | BUNDLE_PATH: "vendor/bundle"
2 | BUNDLE_FORCE_RUBY_PLATFORM: 1
3 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: '@react-native-community',
4 | parser: '@typescript-eslint/parser',
5 | plugins: ['@typescript-eslint'],
6 | overrides: [
7 | {
8 | files: ['*.ts', '*.tsx'],
9 | rules: {
10 | '@typescript-eslint/no-shadow': ['error'],
11 | 'no-shadow': 'off',
12 | 'no-undef': 'off',
13 | },
14 | },
15 | ],
16 | };
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
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 |
35 | # node.js
36 | #
37 | node_modules/
38 | npm-debug.log
39 | yarn-error.log
40 |
41 | # BUCK
42 | buck-out/
43 | \.buckd/
44 | # *.keystore
45 | # !debug.keystore
46 |
47 | # fastlane
48 | #
49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
50 | # screenshots whenever they are needed.
51 | # For more information about the recommended setup visit:
52 | # https://docs.fastlane.tools/best-practices/source-control/
53 |
54 | **/fastlane/report.xml
55 | **/fastlane/Preview.html
56 | **/fastlane/screenshots
57 | **/fastlane/test_output
58 |
59 | # Bundle artifact
60 | *.jsbundle
61 |
62 | # Ruby / CocoaPods
63 | /ios/Pods/
64 | /vendor/bundle/
65 |
--------------------------------------------------------------------------------
/.node-version:
--------------------------------------------------------------------------------
1 | 16
2 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | registry=https://registry.npmjs.org/
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | arrowParens: 'avoid',
3 | bracketSameLine: true,
4 | bracketSpacing: false,
5 | singleQuote: true,
6 | trailingComma: 'all',
7 | };
8 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.7.5
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cSpell.words": [
3 | "iconfont",
4 | "Pressable",
5 | "RNFS",
6 | "todos",
7 | "wiiai's"
8 | ],
9 | "java.configuration.updateBuildConfiguration": "interactive",
10 | // 头部注释
11 | "fileheader.customMade": {
12 | "Author": "git config user.name",
13 | "LastEditors": "git config user.name", // 文件最后编辑者 与Author字段一致
14 | "Date": "Do not edit", // 文件创建时间(不变)
15 | "LastEditTime": "Do not edit", // 文件最后编辑时间
16 | "FilePath": "Do not edit", // 文件在项目中的相对路径 自动更新
17 | "Description": "" // 介绍文件的作用、文件的入参、出参。
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
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.7.5'
5 |
6 | gem 'cocoapods', '~> 1.11', '>= 1.11.2'
7 |
--------------------------------------------------------------------------------
/__tests__/App-test.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../01-App';
8 |
9 | // Note: test renderer must be required after react-native.
10 | import renderer from 'react-test-renderer';
11 |
12 | it('renders correctly', () => {
13 | renderer.create();
14 | });
15 |
--------------------------------------------------------------------------------
/android/app/_BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12 |
13 | lib_deps = []
14 |
15 | create_aar_targets(glob(["libs/*.aar"]))
16 |
17 | create_jar_targets(glob(["libs/*.jar"]))
18 |
19 | android_library(
20 | name = "all-libs",
21 | exported_deps = lib_deps,
22 | )
23 |
24 | android_library(
25 | name = "app-code",
26 | srcs = glob([
27 | "src/main/java/**/*.java",
28 | ]),
29 | deps = [
30 | ":all-libs",
31 | ":build_config",
32 | ":res",
33 | ],
34 | )
35 |
36 | android_build_config(
37 | name = "build_config",
38 | package = "com.wowimrn",
39 | )
40 |
41 | android_resource(
42 | name = "res",
43 | package = "com.wowimrn",
44 | res = "src/main/res",
45 | )
46 |
47 | android_binary(
48 | name = "app",
49 | keystore = "//android/keystores:debug",
50 | manifest = "src/main/AndroidManifest.xml",
51 | package_type = "debug",
52 | deps = [
53 | ":app-code",
54 | ],
55 | )
56 |
--------------------------------------------------------------------------------
/android/app/build_defs.bzl:
--------------------------------------------------------------------------------
1 | """Helper definitions to glob .aar and .jar targets"""
2 |
3 | def create_aar_targets(aarfiles):
4 | for aarfile in aarfiles:
5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6 | lib_deps.append(":" + name)
7 | android_prebuilt_aar(
8 | name = name,
9 | aar = aarfile,
10 | )
11 |
12 | def create_jar_targets(jarfiles):
13 | for jarfile in jarfiles:
14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15 | lib_deps.append(":" + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
--------------------------------------------------------------------------------
/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wiiai/react-native-template/b51f2be006437cfb699a99dabd41a727e50242f5/android/app/debug.keystore
--------------------------------------------------------------------------------
/android/app/my-release-key.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wiiai/react-native-template/b51f2be006437cfb699a99dabd41a727e50242f5/android/app/my-release-key.keystore
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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:
11 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/android/app/src/debug/java/com/wowimrn/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | *
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.wowimrn;
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.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceEventListener;
23 | import com.facebook.react.ReactInstanceManager;
24 | import com.facebook.react.bridge.ReactContext;
25 | import com.facebook.react.modules.network.NetworkingModule;
26 | import okhttp3.OkHttpClient;
27 |
28 | public class ReactNativeFlipper {
29 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
30 | if (FlipperUtils.shouldEnableFlipper(context)) {
31 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
32 |
33 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
34 | client.addPlugin(new ReactFlipperPlugin());
35 | client.addPlugin(new DatabasesFlipperPlugin(context));
36 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
37 | client.addPlugin(CrashReporterPlugin.getInstance());
38 |
39 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
40 | NetworkingModule.setCustomClientBuilder(
41 | new NetworkingModule.CustomClientBuilder() {
42 | @Override
43 | public void apply(OkHttpClient.Builder builder) {
44 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
45 | }
46 | });
47 | client.addPlugin(networkFlipperPlugin);
48 | client.start();
49 |
50 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
51 | // Hence we run if after all native modules have been initialized
52 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
53 | if (reactContext == null) {
54 | reactInstanceManager.addReactInstanceEventListener(
55 | new ReactInstanceEventListener() {
56 | @Override
57 | public void onReactContextInitialized(ReactContext reactContext) {
58 | reactInstanceManager.removeReactInstanceEventListener(this);
59 | reactContext.runOnNativeModulesQueueThread(
60 | new Runnable() {
61 | @Override
62 | public void run() {
63 | client.addPlugin(new FrescoFlipperPlugin());
64 | }
65 | });
66 | }
67 | });
68 | } else {
69 | client.addPlugin(new FrescoFlipperPlugin());
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
38 |
39 |
40 |
42 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
65 |
66 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/wowimrn/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.wowimrn;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.ReactRootView;
6 | import android.os.Bundle;
7 |
8 | public class MainActivity extends ReactActivity {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | @Override
15 | protected String getMainComponentName() {
16 | return "WowImRN";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
21 | * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
22 | * (Paper).
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new MainActivityDelegate(this, getMainComponentName());
27 | }
28 |
29 | public static class MainActivityDelegate extends ReactActivityDelegate {
30 | public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
31 | super(activity, mainComponentName);
32 | }
33 |
34 | @Override
35 | protected ReactRootView createRootView() {
36 | ReactRootView reactRootView = new ReactRootView(getContext());
37 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
38 | reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
39 | return reactRootView;
40 | }
41 |
42 | @Override
43 | protected boolean isConcurrentRootEnabled() {
44 | // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
45 | // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
46 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
47 | }
48 |
49 | @Override
50 | protected void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(null);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/wowimrn/MainApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: GaoXiong
3 | * @LastEditors: GaoXiong
4 | * @Date: 2023-01-04 18:54:10
5 | * @LastEditTime: 2023-04-11 22:50:43
6 | * @FilePath: /react-native-template/android/app/src/main/java/com/wowimrn/MainApplication.java
7 | * @Description:
8 | */
9 | package com.wowimrn;
10 |
11 | import android.app.Application;
12 | import android.content.Context;
13 | import com.facebook.react.PackageList;
14 | import com.facebook.react.ReactApplication;
15 | import com.facebook.react.ReactInstanceManager;
16 | import com.facebook.react.ReactNativeHost;
17 | import com.facebook.react.ReactPackage;
18 | import com.facebook.react.config.ReactFeatureFlags;
19 | import com.facebook.soloader.SoLoader;
20 | import com.wowimrn.newarchitecture.MainApplicationReactNativeHost;
21 | import java.lang.reflect.InvocationTargetException;
22 | import java.util.List;
23 | import com.rnfs.RNFSPackage;
24 |
25 | public class MainApplication extends Application implements ReactApplication {
26 |
27 | private final ReactNativeHost mReactNativeHost =
28 | new ReactNativeHost(this) {
29 | @Override
30 | public boolean getUseDeveloperSupport() {
31 | return BuildConfig.DEBUG;
32 | }
33 |
34 | @Override
35 | protected List getPackages() {
36 | @SuppressWarnings("UnnecessaryLocalVariable")
37 | List packages = new PackageList(this).getPackages();
38 |
39 | // 不能自动注册的 package需要手动注册
40 | // Packages that cannot be autolinked yet can be added manually here, for example:
41 | packages.add(new RCTButtonPackage());
42 |
43 | return packages;
44 | }
45 |
46 | @Override
47 | protected String getJSMainModuleName() {
48 | return "index";
49 | }
50 | };
51 |
52 | private final ReactNativeHost mNewArchitectureNativeHost =
53 | new MainApplicationReactNativeHost(this);
54 |
55 | @Override
56 | public ReactNativeHost getReactNativeHost() {
57 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
58 | return mNewArchitectureNativeHost;
59 | } else {
60 | return mReactNativeHost;
61 | }
62 | }
63 |
64 | @Override
65 | public void onCreate() {
66 | super.onCreate();
67 | // If you opted-in for the New Architecture, we enable the TurboModule system
68 | ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
69 | SoLoader.init(this, /* native exopackage */ false);
70 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
71 | }
72 |
73 | /**
74 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like
75 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
76 | *
77 | * @param context
78 | * @param reactInstanceManager
79 | */
80 | private static void initializeFlipper(
81 | Context context, ReactInstanceManager reactInstanceManager) {
82 | if (BuildConfig.DEBUG) {
83 | try {
84 | /*
85 | We use reflection here to pick up the class that initializes Flipper,
86 | since Flipper library is not available in release mode
87 | */
88 | Class> aClass = Class.forName("com.wowimrn.ReactNativeFlipper");
89 | aClass
90 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
91 | .invoke(null, context, reactInstanceManager);
92 | } catch (ClassNotFoundException e) {
93 | e.printStackTrace();
94 | } catch (NoSuchMethodException e) {
95 | e.printStackTrace();
96 | } catch (IllegalAccessException e) {
97 | e.printStackTrace();
98 | } catch (InvocationTargetException e) {
99 | e.printStackTrace();
100 | }
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/wowimrn/RCTButton.java:
--------------------------------------------------------------------------------
1 | package com.wowimrn;
2 |
3 | import android.view.View;
4 | import android.widget.Button;
5 |
6 | import com.facebook.react.bridge.Arguments;
7 | import com.facebook.react.bridge.WritableMap;
8 | import com.facebook.react.common.MapBuilder;
9 | import com.facebook.react.uimanager.SimpleViewManager;
10 | import com.facebook.react.uimanager.ThemedReactContext;
11 | import com.facebook.react.uimanager.annotations.ReactProp;
12 | import com.facebook.react.uimanager.events.RCTEventEmitter;
13 |
14 | import java.util.Map;
15 |
16 | import javax.annotation.Nullable;
17 |
18 | public class RCTButton extends SimpleViewManager