Skip to content

Commit ddfddfb

Browse files
committed
rename package
1 parent f513cb2 commit ddfddfb

File tree

9 files changed

+95
-87
lines changed

9 files changed

+95
-87
lines changed

example/android/app/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ android {
126126
}
127127

128128
defaultConfig {
129-
applicationId "com.example"
129+
applicationId "com.rndatetimepickerexample"
130130
minSdkVersion rootProject.ext.minSdkVersion
131131
targetSdkVersion rootProject.ext.targetSdkVersion
132132
versionCode 1
@@ -188,20 +188,21 @@ android {
188188
dependencies {
189189
implementation fileTree(dir: "libs", include: ["*.jar"])
190190
implementation "com.facebook.react:react-native:+" // From node_modules
191+
implementation(project(":react-native-datetimepicker"))
191192

192193
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
193-
implementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
194+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
194195
exclude group:'com.facebook.fbjni'
195196
}
196-
implementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
197+
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
197198
exclude group:'com.facebook.flipper'
198199
}
199-
implementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
200+
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
200201
exclude group:'com.facebook.flipper'
201202
}
202203

203204
if (enableHermes) {
204-
def hermesPath = "../../node_modules/hermes-engine/android/";
205+
def hermesPath = "../../../node_modules/hermes-engine/android/";
205206
debugImplementation files(hermesPath + "hermes-debug.aar")
206207
releaseImplementation files(hermesPath + "hermes-release.aar")
207208
} else {

example/android/app/src/androidTest/java/com/example/DetoxTest.java renamed to example/android/app/src/androidTest/java/com/rndatetimepickerexample/DetoxTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example;
1+
package com.rndatetimepickerexample;
22

33
import com.wix.detox.Detox;
44

example/android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example">
2+
package="com.rndatetimepickerexample">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55

66
<application
7-
android:name=".MainApplication"
7+
android:name="com.rndatetimepickerexample.MainApplication"
88
android:label="@string/app_name"
99
android:icon="@mipmap/ic_launcher"
1010
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:allowBackup="false"
1212
android:theme="@style/AppTheme">
1313
<activity
14-
android:name=".MainActivity"
14+
android:name="com.rndatetimepickerexample.MainActivity"
1515
android:label="@string/app_name"
1616
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
1717
android:launchMode="singleTask"

example/android/app/src/main/java/com/example/ReactNativeFlipper.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

example/android/app/src/main/java/com/example/MainActivity.java renamed to example/android/app/src/main/java/com/rndatetimepickerexample/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example;
1+
package com.rndatetimepickerexample;
22

33
import com.facebook.react.ReactActivity;
44

example/android/app/src/main/java/com/example/MainApplication.java renamed to example/android/app/src/main/java/com/rndatetimepickerexample/MainApplication.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example;
1+
package com.rndatetimepickerexample;
22

33
import android.app.Application;
44
import android.content.Context;
@@ -8,6 +8,8 @@
88
import com.facebook.react.ReactNativeHost;
99
import com.facebook.react.ReactPackage;
1010
import com.facebook.soloader.SoLoader;
11+
import com.reactcommunity.rndatetimepicker.RNDateTimePickerPackage;
12+
1113
import java.lang.reflect.InvocationTargetException;
1214
import java.util.List;
1315

@@ -24,14 +26,15 @@ public boolean getUseDeveloperSupport() {
2426
protected List<ReactPackage> getPackages() {
2527
@SuppressWarnings("UnnecessaryLocalVariable")
2628
List<ReactPackage> packages = new PackageList(this).getPackages();
29+
packages.add(new RNDateTimePickerPackage());
2730
// Packages that cannot be autolinked yet can be added manually here, for example:
2831
// packages.add(new MyReactNativePackage());
2932
return packages;
3033
}
3134

3235
@Override
3336
protected String getJSMainModuleName() {
34-
return "index";
37+
return "example/index";
3538
}
3639
};
3740

@@ -62,7 +65,7 @@ private static void initializeFlipper(
6265
We use reflection here to pick up the class that initializes Flipper,
6366
since Flipper library is not available in release mode
6467
*/
65-
Class<?> aClass = Class.forName("com.example.ReactNativeFlipper");
68+
Class<?> aClass = Class.forName("com.rndatetimepickerexample.ReactNativeFlipper");
6669
aClass
6770
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
6871
.invoke(null, context, reactInstanceManager);
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
///**
2+
// * Copyright (c) Facebook, Inc. and its 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.rndatetimepickerexample;
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.ReactInstanceManager;
23+
//import com.facebook.react.bridge.ReactContext;
24+
//import com.facebook.react.modules.network.NetworkingModule;
25+
//import okhttp3.OkHttpClient;
26+
//
27+
//public class ReactNativeFlipper {
28+
// public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29+
// if (FlipperUtils.shouldEnableFlipper(context)) {
30+
// final FlipperClient client = AndroidFlipperClient.getInstance(context);
31+
//
32+
// client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33+
// client.addPlugin(new ReactFlipperPlugin());
34+
// client.addPlugin(new DatabasesFlipperPlugin(context));
35+
// client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36+
// client.addPlugin(CrashReporterPlugin.getInstance());
37+
//
38+
// NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39+
// NetworkingModule.setCustomClientBuilder(
40+
// new NetworkingModule.CustomClientBuilder() {
41+
// @Override
42+
// public void apply(OkHttpClient.Builder builder) {
43+
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44+
// }
45+
// });
46+
// client.addPlugin(networkFlipperPlugin);
47+
// client.start();
48+
//
49+
// // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50+
// // Hence we run if after all native modules have been initialized
51+
// ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52+
// if (reactContext == null) {
53+
// reactInstanceManager.addReactInstanceEventListener(
54+
// new ReactInstanceManager.ReactInstanceEventListener() {
55+
// @Override
56+
// public void onReactContextInitialized(ReactContext reactContext) {
57+
// reactInstanceManager.removeReactInstanceEventListener(this);
58+
// reactContext.runOnNativeModulesQueueThread(
59+
// new Runnable() {
60+
// @Override
61+
// public void run() {
62+
// client.addPlugin(new FrescoFlipperPlugin());
63+
// }
64+
// });
65+
// }
66+
// });
67+
// } else {
68+
// client.addPlugin(new FrescoFlipperPlugin());
69+
// }
70+
// }
71+
// }
72+
//}

example/android/settings.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
rootProject.name = 'example'
22

33
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
4-
applyNativeModulesSettingsGradle(settings, "../..")
4+
// auto-linking does not work here, why?
5+
//applyNativeModulesSettingsGradle(settings, "../..")
6+
include ':react-native-datetimepicker'
7+
project(':react-native-datetimepicker').projectDir = new File(rootProject.projectDir, '../../android')
8+
59

610
include ':app'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"build": "export RCT_NO_LAUNCH_PACKAGER=true && cd example/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ../..",
9999
"type": "android.emulator",
100100
"device": {
101-
"avdName": "Nexus_5X_API_28"
101+
"avdName": "TestingAVD"
102102
}
103103
},
104104
"android.emu.release": {

0 commit comments

Comments
 (0)