react-native-universal-keyboard-aware-scrollview 1.0.0 → 1.0.2

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 (70) hide show
  1. package/README.md +134 -242
  2. package/android/build.gradle +2 -17
  3. package/package.json +8 -14
  4. package/react-native-universal-keyboard-aware-scrollview.podspec +3 -12
  5. package/src/components/KeyboardAwareScrollView.tsx +193 -84
  6. package/src/hooks/useKeyboard.ts +78 -73
  7. package/android/app/build.gradle +0 -182
  8. package/android/app/debug.keystore +0 -0
  9. package/android/app/proguard-rules.pro +0 -14
  10. package/android/app/src/debug/AndroidManifest.xml +0 -7
  11. package/android/app/src/debugOptimized/AndroidManifest.xml +0 -7
  12. package/android/app/src/main/AndroidManifest.xml +0 -25
  13. package/android/app/src/main/java/com/anonymous/reactnativeuniversalkeyboardawarescrollview/MainActivity.kt +0 -61
  14. package/android/app/src/main/java/com/anonymous/reactnativeuniversalkeyboardawarescrollview/MainApplication.kt +0 -56
  15. package/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -6
  16. package/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
  17. package/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
  18. package/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
  19. package/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
  20. package/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
  21. package/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
  22. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  23. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  24. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  25. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
  26. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  27. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  28. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
  29. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  30. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  31. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
  32. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  33. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  34. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
  35. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  36. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  37. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
  38. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  39. package/android/app/src/main/res/values/colors.xml +0 -6
  40. package/android/app/src/main/res/values/strings.xml +0 -5
  41. package/android/app/src/main/res/values/styles.xml +0 -11
  42. package/android/app/src/main/res/values-night/colors.xml +0 -1
  43. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  44. package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  45. package/android/gradle.properties +0 -65
  46. package/android/gradlew +0 -251
  47. package/android/gradlew.bat +0 -94
  48. package/android/settings.gradle +0 -39
  49. package/ios/.xcode.env +0 -11
  50. package/ios/Podfile +0 -60
  51. package/ios/Podfile.lock +0 -2001
  52. package/ios/Podfile.properties.json +0 -5
  53. package/ios/reactnativeuniversalkeyboardawarescrollview/AppDelegate.swift +0 -70
  54. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  55. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
  56. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/Contents.json +0 -6
  57. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/SplashScreenBackground.colorset/Contents.json +0 -20
  58. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/SplashScreenLegacy.imageset/Contents.json +0 -23
  59. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/SplashScreenLegacy.imageset/image.png +0 -0
  60. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/SplashScreenLegacy.imageset/image@2x.png +0 -0
  61. package/ios/reactnativeuniversalkeyboardawarescrollview/Images.xcassets/SplashScreenLegacy.imageset/image@3x.png +0 -0
  62. package/ios/reactnativeuniversalkeyboardawarescrollview/Info.plist +0 -76
  63. package/ios/reactnativeuniversalkeyboardawarescrollview/PrivacyInfo.xcprivacy +0 -48
  64. package/ios/reactnativeuniversalkeyboardawarescrollview/SplashScreen.storyboard +0 -48
  65. package/ios/reactnativeuniversalkeyboardawarescrollview/Supporting/Expo.plist +0 -12
  66. package/ios/reactnativeuniversalkeyboardawarescrollview/reactnativeuniversalkeyboardawarescrollview-Bridging-Header.h +0 -3
  67. package/ios/reactnativeuniversalkeyboardawarescrollview/reactnativeuniversalkeyboardawarescrollview.entitlements +0 -5
  68. package/ios/reactnativeuniversalkeyboardawarescrollview.xcodeproj/project.pbxproj +0 -540
  69. package/ios/reactnativeuniversalkeyboardawarescrollview.xcodeproj/xcshareddata/xcschemes/reactnativeuniversalkeyboardawarescrollview.xcscheme +0 -88
  70. package/ios/reactnativeuniversalkeyboardawarescrollview.xcworkspace/contents.xcworkspacedata +0 -10
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState, useCallback, useRef } from 'react';
2
- import { Platform, Keyboard, LayoutAnimation, UIManager } from 'react-native';
2
+ import { Platform, Keyboard, LayoutAnimation, UIManager, Dimensions } from 'react-native';
3
3
  import {
4
4
  UniversalKeyboardModule,
5
5
  KeyboardEventEmitter,
@@ -39,6 +39,15 @@ export interface UseKeyboardOptions {
39
39
  onKeyboardHeightChange?: (height: number) => void;
40
40
  }
41
41
 
42
+ interface KeyboardState {
43
+ keyboardHeight: number;
44
+ isKeyboardVisible: boolean;
45
+ isAnimating: boolean;
46
+ screenHeight: number;
47
+ animationDuration: number;
48
+ safeAreaBottom: number;
49
+ }
50
+
42
51
  /**
43
52
  * Return type for useKeyboard hook
44
53
  */
@@ -67,18 +76,7 @@ export interface UseKeyboardReturn {
67
76
  * - React Native Modal components
68
77
  * - BottomSheet components
69
78
  * - Any overlay/presentation scenarios
70
- *
71
- * @example
72
- * ```tsx
73
- * const { keyboardHeight, isKeyboardVisible, dismissKeyboard } = useKeyboard();
74
- *
75
- * return (
76
- * <View style={{ paddingBottom: keyboardHeight }}>
77
- * <TextInput placeholder="Type here..." />
78
- * <Button onPress={dismissKeyboard} title="Dismiss" />
79
- * </View>
80
- * );
81
- * ```
79
+ * - Multiline TextInput (textarea) fields
82
80
  */
83
81
  export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn {
84
82
  const {
@@ -93,11 +91,13 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
93
91
  onKeyboardHeightChange,
94
92
  } = options;
95
93
 
96
- const [keyboardState, setKeyboardState] = useState({
94
+ const { height: initialScreenHeight } = Dimensions.get('window');
95
+
96
+ const [keyboardState, setKeyboardState] = useState<KeyboardState>({
97
97
  keyboardHeight: 0,
98
98
  isKeyboardVisible: false,
99
99
  isAnimating: false,
100
- screenHeight: 0,
100
+ screenHeight: initialScreenHeight,
101
101
  animationDuration: 0,
102
102
  safeAreaBottom: 0,
103
103
  });
@@ -107,8 +107,9 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
107
107
  (Platform.OS === 'ios' && enableOnIOS);
108
108
 
109
109
  const nativeModuleActive = useRef(false);
110
+ const lastHeightRef = useRef(0);
110
111
 
111
- // Handle keyboard height change
112
+ // Handle keyboard height change with debounce to prevent flicker
112
113
  const handleKeyboardHeightChange = useCallback(
113
114
  (event: KeyboardEvent) => {
114
115
  if (!isEnabled) return;
@@ -116,7 +117,11 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
116
117
  const height = event.height ?? 0;
117
118
  const duration = event.duration ?? 250;
118
119
 
119
- if (animated && duration > 0) {
120
+ // Prevent duplicate updates
121
+ if (height === lastHeightRef.current) return;
122
+ lastHeightRef.current = height;
123
+
124
+ if (animated && duration > 0 && Platform.OS === 'ios') {
120
125
  LayoutAnimation.configureNext({
121
126
  duration: duration,
122
127
  update: {
@@ -126,7 +131,7 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
126
131
  });
127
132
  }
128
133
 
129
- setKeyboardState((prev) => ({
134
+ setKeyboardState((prev: KeyboardState) => ({
130
135
  ...prev,
131
136
  keyboardHeight: height,
132
137
  isKeyboardVisible: height > 0,
@@ -146,7 +151,7 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
146
151
  (event: KeyboardEvent) => {
147
152
  if (!isEnabled) return;
148
153
 
149
- setKeyboardState((prev) => ({
154
+ setKeyboardState((prev: KeyboardState) => ({
150
155
  ...prev,
151
156
  isAnimating: true,
152
157
  }));
@@ -161,7 +166,7 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
161
166
  (event: KeyboardEvent) => {
162
167
  if (!isEnabled) return;
163
168
 
164
- setKeyboardState((prev) => ({
169
+ setKeyboardState((prev: KeyboardState) => ({
165
170
  ...prev,
166
171
  isAnimating: true,
167
172
  }));
@@ -176,9 +181,12 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
176
181
  (event: KeyboardEvent) => {
177
182
  if (!isEnabled) return;
178
183
 
179
- setKeyboardState((prev) => ({
184
+ const height = event.height ?? 0;
185
+ lastHeightRef.current = height;
186
+
187
+ setKeyboardState((prev: KeyboardState) => ({
180
188
  ...prev,
181
- keyboardHeight: event.height,
189
+ keyboardHeight: height,
182
190
  isKeyboardVisible: true,
183
191
  isAnimating: false,
184
192
  screenHeight: event.screenHeight ?? prev.screenHeight,
@@ -195,7 +203,9 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
195
203
  (event: KeyboardEvent) => {
196
204
  if (!isEnabled) return;
197
205
 
198
- setKeyboardState((prev) => ({
206
+ lastHeightRef.current = 0;
207
+
208
+ setKeyboardState((prev: KeyboardState) => ({
199
209
  ...prev,
200
210
  keyboardHeight: 0,
201
211
  isKeyboardVisible: false,
@@ -234,62 +244,42 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
234
244
  .then(() => {
235
245
  nativeModuleActive.current = true;
236
246
  })
237
- .catch((error) => {
247
+ .catch((error: Error) => {
238
248
  console.warn('[useKeyboard] Failed to start native listener:', error);
239
249
  });
240
250
 
241
251
  // Subscribe to native events
242
- subscriptions.push(
243
- (() => {
244
- const sub = KeyboardEventEmitter.addListener(
245
- 'keyboardHeightChanged',
246
- handleKeyboardHeightChange
247
- );
248
- return () => sub.remove();
249
- })()
252
+ const heightSub = KeyboardEventEmitter.addListener(
253
+ 'keyboardHeightChanged',
254
+ handleKeyboardHeightChange
250
255
  );
256
+ subscriptions.push(() => heightSub.remove());
251
257
 
252
- subscriptions.push(
253
- (() => {
254
- const sub = KeyboardEventEmitter.addListener(
255
- 'keyboardDidShow',
256
- handleKeyboardDidShow
257
- );
258
- return () => sub.remove();
259
- })()
258
+ const didShowSub = KeyboardEventEmitter.addListener(
259
+ 'keyboardDidShow',
260
+ handleKeyboardDidShow
260
261
  );
262
+ subscriptions.push(() => didShowSub.remove());
261
263
 
262
- subscriptions.push(
263
- (() => {
264
- const sub = KeyboardEventEmitter.addListener(
265
- 'keyboardDidHide',
266
- handleKeyboardDidHide
267
- );
268
- return () => sub.remove();
269
- })()
264
+ const didHideSub = KeyboardEventEmitter.addListener(
265
+ 'keyboardDidHide',
266
+ handleKeyboardDidHide
270
267
  );
268
+ subscriptions.push(() => didHideSub.remove());
271
269
 
272
270
  // iOS only events
273
271
  if (Platform.OS === 'ios') {
274
- subscriptions.push(
275
- (() => {
276
- const sub = KeyboardEventEmitter.addListener(
277
- 'keyboardWillShow',
278
- handleKeyboardWillShow
279
- );
280
- return () => sub.remove();
281
- })()
272
+ const willShowSub = KeyboardEventEmitter.addListener(
273
+ 'keyboardWillShow',
274
+ handleKeyboardWillShow
282
275
  );
276
+ subscriptions.push(() => willShowSub.remove());
283
277
 
284
- subscriptions.push(
285
- (() => {
286
- const sub = KeyboardEventEmitter.addListener(
287
- 'keyboardWillHide',
288
- handleKeyboardWillHide
289
- );
290
- return () => sub.remove();
291
- })()
278
+ const willHideSub = KeyboardEventEmitter.addListener(
279
+ 'keyboardWillHide',
280
+ handleKeyboardWillHide
292
281
  );
282
+ subscriptions.push(() => willHideSub.remove());
293
283
  }
294
284
  } else {
295
285
  // Fall back to React Native Keyboard API
@@ -297,39 +287,39 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
297
287
  height: e.endCoordinates?.height ?? 0,
298
288
  isVisible: true,
299
289
  duration: e.duration ? e.duration * 1000 : 250,
300
- screenHeight: e.endCoordinates?.screenY ?? 0,
290
+ screenHeight: e.endCoordinates?.screenY ?? initialScreenHeight,
301
291
  timestamp: Date.now(),
302
292
  endCoordinates: e.endCoordinates,
303
293
  startCoordinates: e.startCoordinates,
304
294
  });
305
295
 
306
- const showSub = Keyboard.addListener('keyboardDidShow', (e) =>
296
+ const showSub = Keyboard.addListener('keyboardDidShow', (e: any) =>
307
297
  handleKeyboardDidShow(mapRNKeyboardEvent(e))
308
298
  );
309
- const hideSub = Keyboard.addListener('keyboardDidHide', (e) =>
299
+ subscriptions.push(() => showSub.remove());
300
+
301
+ const hideSub = Keyboard.addListener('keyboardDidHide', () =>
310
302
  handleKeyboardDidHide({
311
303
  height: 0,
312
304
  isVisible: false,
313
305
  timestamp: Date.now(),
314
306
  })
315
307
  );
316
-
317
- subscriptions.push(() => showSub.remove());
318
308
  subscriptions.push(() => hideSub.remove());
319
309
 
320
310
  if (Platform.OS === 'ios') {
321
- const willShowSub = Keyboard.addListener('keyboardWillShow', (e) =>
311
+ const willShowSub = Keyboard.addListener('keyboardWillShow', (e: any) =>
322
312
  handleKeyboardWillShow(mapRNKeyboardEvent(e))
323
313
  );
324
- const willHideSub = Keyboard.addListener('keyboardWillHide', (e) =>
314
+ subscriptions.push(() => willShowSub.remove());
315
+
316
+ const willHideSub = Keyboard.addListener('keyboardWillHide', () =>
325
317
  handleKeyboardWillHide({
326
318
  height: 0,
327
319
  isVisible: false,
328
320
  timestamp: Date.now(),
329
321
  })
330
322
  );
331
-
332
- subscriptions.push(() => willShowSub.remove());
333
323
  subscriptions.push(() => willHideSub.remove());
334
324
  }
335
325
  }
@@ -346,6 +336,7 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
346
336
  }, [
347
337
  isEnabled,
348
338
  useNativeEvents,
339
+ initialScreenHeight,
349
340
  handleKeyboardHeightChange,
350
341
  handleKeyboardWillShow,
351
342
  handleKeyboardWillHide,
@@ -353,6 +344,20 @@ export function useKeyboard(options: UseKeyboardOptions = {}): UseKeyboardReturn
353
344
  handleKeyboardDidHide,
354
345
  ]);
355
346
 
347
+ // Update screen height on dimension change
348
+ useEffect(() => {
349
+ const subscription = Dimensions.addEventListener('change', ({ window }) => {
350
+ setKeyboardState((prev: KeyboardState) => ({
351
+ ...prev,
352
+ screenHeight: window.height,
353
+ }));
354
+ });
355
+
356
+ return () => {
357
+ subscription?.remove();
358
+ };
359
+ }, []);
360
+
356
361
  return {
357
362
  ...keyboardState,
358
363
  dismissKeyboard,
@@ -1,182 +0,0 @@
1
- apply plugin: "com.android.application"
2
- apply plugin: "org.jetbrains.kotlin.android"
3
- apply plugin: "com.facebook.react"
4
-
5
- def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
6
-
7
- /**
8
- * This is the configuration block to customize your React Native Android app.
9
- * By default you don't need to apply any configuration, just uncomment the lines you need.
10
- */
11
- react {
12
- entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
13
- reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
14
- hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
15
- codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16
-
17
- enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
18
- // Use Expo CLI to bundle the app, this ensures the Metro config
19
- // works correctly with Expo projects.
20
- cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
21
- bundleCommand = "export:embed"
22
-
23
- /* Folders */
24
- // The root of your project, i.e. where "package.json" lives. Default is '../..'
25
- // root = file("../../")
26
- // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
27
- // reactNativeDir = file("../../node_modules/react-native")
28
- // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
29
- // codegenDir = file("../../node_modules/@react-native/codegen")
30
-
31
- /* Variants */
32
- // The list of variants to that are debuggable. For those we're going to
33
- // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
34
- // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
35
- // debuggableVariants = ["liteDebug", "prodDebug"]
36
-
37
- /* Bundling */
38
- // A list containing the node command and its flags. Default is just 'node'.
39
- // nodeExecutableAndArgs = ["node"]
40
-
41
- //
42
- // The path to the CLI configuration file. Default is empty.
43
- // bundleConfig = file(../rn-cli.config.js)
44
- //
45
- // The name of the generated asset file containing your JS bundle
46
- // bundleAssetName = "MyApplication.android.bundle"
47
- //
48
- // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
49
- // entryFile = file("../js/MyApplication.android.js")
50
- //
51
- // A list of extra flags to pass to the 'bundle' commands.
52
- // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
53
- // extraPackagerArgs = []
54
-
55
- /* Hermes Commands */
56
- // The hermes compiler command to run. By default it is 'hermesc'
57
- // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
58
- //
59
- // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
60
- // hermesFlags = ["-O", "-output-source-map"]
61
-
62
- /* Autolinking */
63
- autolinkLibrariesWithApp()
64
- }
65
-
66
- /**
67
- * Set this to true in release builds to optimize the app using [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization).
68
- */
69
- def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBuilds') ?: false).toBoolean()
70
-
71
- /**
72
- * The preferred build flavor of JavaScriptCore (JSC)
73
- *
74
- * For example, to use the international variant, you can use:
75
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
76
- *
77
- * The international variant includes ICU i18n library and necessary data
78
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
79
- * give correct results when using with locales other than en-US. Note that
80
- * this variant is about 6MiB larger per architecture than default.
81
- */
82
- def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
83
-
84
- android {
85
- ndkVersion rootProject.ext.ndkVersion
86
-
87
- buildToolsVersion rootProject.ext.buildToolsVersion
88
- compileSdk rootProject.ext.compileSdkVersion
89
-
90
- namespace 'com.anonymous.reactnativeuniversalkeyboardawarescrollview'
91
- defaultConfig {
92
- applicationId 'com.anonymous.reactnativeuniversalkeyboardawarescrollview'
93
- minSdkVersion rootProject.ext.minSdkVersion
94
- targetSdkVersion rootProject.ext.targetSdkVersion
95
- versionCode 1
96
- versionName "1.0.0"
97
-
98
- buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
99
- }
100
- signingConfigs {
101
- debug {
102
- storeFile file('debug.keystore')
103
- storePassword 'android'
104
- keyAlias 'androiddebugkey'
105
- keyPassword 'android'
106
- }
107
- }
108
- buildTypes {
109
- debug {
110
- signingConfig signingConfigs.debug
111
- }
112
- release {
113
- // Caution! In production, you need to generate your own keystore file.
114
- // see https://reactnative.dev/docs/signed-apk-android.
115
- signingConfig signingConfigs.debug
116
- def enableShrinkResources = findProperty('android.enableShrinkResourcesInReleaseBuilds') ?: 'false'
117
- shrinkResources enableShrinkResources.toBoolean()
118
- minifyEnabled enableMinifyInReleaseBuilds
119
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
120
- def enablePngCrunchInRelease = findProperty('android.enablePngCrunchInReleaseBuilds') ?: 'true'
121
- crunchPngs enablePngCrunchInRelease.toBoolean()
122
- }
123
- }
124
- packagingOptions {
125
- jniLibs {
126
- def enableLegacyPackaging = findProperty('expo.useLegacyPackaging') ?: 'false'
127
- useLegacyPackaging enableLegacyPackaging.toBoolean()
128
- }
129
- }
130
- androidResources {
131
- ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
132
- }
133
- }
134
-
135
- // Apply static values from `gradle.properties` to the `android.packagingOptions`
136
- // Accepts values in comma delimited lists, example:
137
- // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
138
- ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
139
- // Split option: 'foo,bar' -> ['foo', 'bar']
140
- def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
141
- // Trim all elements in place.
142
- for (i in 0..<options.size()) options[i] = options[i].trim();
143
- // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
144
- options -= ""
145
-
146
- if (options.length > 0) {
147
- println "android.packagingOptions.$prop += $options ($options.length)"
148
- // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
149
- options.each {
150
- android.packagingOptions[prop] += it
151
- }
152
- }
153
- }
154
-
155
- dependencies {
156
- // The version of react-native is set by the React Native Gradle Plugin
157
- implementation("com.facebook.react:react-android")
158
-
159
- def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
160
- def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
161
- def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
162
-
163
- if (isGifEnabled) {
164
- // For animated gif support
165
- implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}")
166
- }
167
-
168
- if (isWebpEnabled) {
169
- // For webp support
170
- implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}")
171
- if (isWebpAnimatedEnabled) {
172
- // Animated webp support
173
- implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}")
174
- }
175
- }
176
-
177
- if (hermesEnabled.toBoolean()) {
178
- implementation("com.facebook.react:hermes-android")
179
- } else {
180
- implementation jscFlavor
181
- }
182
- }
Binary file
@@ -1,14 +0,0 @@
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
- # react-native-reanimated
11
- -keep class com.swmansion.reanimated.** { *; }
12
- -keep class com.facebook.react.turbomodule.** { *; }
13
-
14
- # Add any project specific keep options here:
@@ -1,7 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools">
3
-
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
-
6
- <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
7
- </manifest>
@@ -1,7 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools">
3
-
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
-
6
- <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
7
- </manifest>
@@ -1,25 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- <uses-permission android:name="android.permission.INTERNET"/>
3
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
- <uses-permission android:name="android.permission.VIBRATE"/>
6
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7
- <queries>
8
- <intent>
9
- <action android:name="android.intent.action.VIEW"/>
10
- <category android:name="android.intent.category.BROWSABLE"/>
11
- <data android:scheme="https"/>
12
- </intent>
13
- </queries>
14
- <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false">
15
- <meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
16
- <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
17
- <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
18
- <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
19
- <intent-filter>
20
- <action android:name="android.intent.action.MAIN"/>
21
- <category android:name="android.intent.category.LAUNCHER"/>
22
- </intent-filter>
23
- </activity>
24
- </application>
25
- </manifest>
@@ -1,61 +0,0 @@
1
- package com.anonymous.reactnativeuniversalkeyboardawarescrollview
2
-
3
- import android.os.Build
4
- import android.os.Bundle
5
-
6
- import com.facebook.react.ReactActivity
7
- import com.facebook.react.ReactActivityDelegate
8
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
9
- import com.facebook.react.defaults.DefaultReactActivityDelegate
10
-
11
- import expo.modules.ReactActivityDelegateWrapper
12
-
13
- class MainActivity : ReactActivity() {
14
- override fun onCreate(savedInstanceState: Bundle?) {
15
- // Set the theme to AppTheme BEFORE onCreate to support
16
- // coloring the background, status bar, and navigation bar.
17
- // This is required for expo-splash-screen.
18
- setTheme(R.style.AppTheme);
19
- super.onCreate(null)
20
- }
21
-
22
- /**
23
- * Returns the name of the main component registered from JavaScript. This is used to schedule
24
- * rendering of the component.
25
- */
26
- override fun getMainComponentName(): String = "main"
27
-
28
- /**
29
- * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
30
- * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
31
- */
32
- override fun createReactActivityDelegate(): ReactActivityDelegate {
33
- return ReactActivityDelegateWrapper(
34
- this,
35
- BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
36
- object : DefaultReactActivityDelegate(
37
- this,
38
- mainComponentName,
39
- fabricEnabled
40
- ){})
41
- }
42
-
43
- /**
44
- * Align the back button behavior with Android S
45
- * where moving root activities to background instead of finishing activities.
46
- * @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
47
- */
48
- override fun invokeDefaultOnBackPressed() {
49
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
50
- if (!moveTaskToBack(false)) {
51
- // For non-root activities, use the default implementation to finish them.
52
- super.invokeDefaultOnBackPressed()
53
- }
54
- return
55
- }
56
-
57
- // Use the default back button implementation on Android S
58
- // because it's doing more than [Activity.moveTaskToBack] in fact.
59
- super.invokeDefaultOnBackPressed()
60
- }
61
- }
@@ -1,56 +0,0 @@
1
- package com.anonymous.reactnativeuniversalkeyboardawarescrollview
2
-
3
- import android.app.Application
4
- import android.content.res.Configuration
5
-
6
- import com.facebook.react.PackageList
7
- import com.facebook.react.ReactApplication
8
- import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
9
- import com.facebook.react.ReactNativeHost
10
- import com.facebook.react.ReactPackage
11
- import com.facebook.react.ReactHost
12
- import com.facebook.react.common.ReleaseLevel
13
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
14
- import com.facebook.react.defaults.DefaultReactNativeHost
15
-
16
- import expo.modules.ApplicationLifecycleDispatcher
17
- import expo.modules.ReactNativeHostWrapper
18
-
19
- class MainApplication : Application(), ReactApplication {
20
-
21
- override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
22
- this,
23
- object : DefaultReactNativeHost(this) {
24
- override fun getPackages(): List<ReactPackage> =
25
- PackageList(this).packages.apply {
26
- // Packages that cannot be autolinked yet can be added manually here, for example:
27
- // add(MyReactNativePackage())
28
- }
29
-
30
- override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
31
-
32
- override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
33
-
34
- override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
35
- }
36
- )
37
-
38
- override val reactHost: ReactHost
39
- get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
40
-
41
- override fun onCreate() {
42
- super.onCreate()
43
- DefaultNewArchitectureEntryPoint.releaseLevel = try {
44
- ReleaseLevel.valueOf(BuildConfig.REACT_NATIVE_RELEASE_LEVEL.uppercase())
45
- } catch (e: IllegalArgumentException) {
46
- ReleaseLevel.STABLE
47
- }
48
- loadReactNative(this)
49
- ApplicationLifecycleDispatcher.onApplicationCreate(this)
50
- }
51
-
52
- override fun onConfigurationChanged(newConfig: Configuration) {
53
- super.onConfigurationChanged(newConfig)
54
- ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
55
- }
56
- }
@@ -1,6 +0,0 @@
1
- <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
2
- <item android:drawable="@color/splashscreen_background"/>
3
- <item>
4
- <bitmap android:gravity="center" android:src="@drawable/splashscreen_logo"/>
5
- </item>
6
- </layer-list>