clox-view-switcher 0.1.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.
- package/.eslintrc.js +2 -0
- package/README.md +35 -0
- package/android/build.gradle +42 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/cloxviewswitcher/CloxViewSwitcherModule.kt +21 -0
- package/android/src/main/java/expo/modules/cloxviewswitcher/CloxViewSwitcherView.kt +34 -0
- package/build/CloxViewSwitcher.types.d.ts +48 -0
- package/build/CloxViewSwitcher.types.d.ts.map +1 -0
- package/build/CloxViewSwitcher.types.js +2 -0
- package/build/CloxViewSwitcher.types.js.map +1 -0
- package/build/CloxViewSwitcherModule.d.ts +8 -0
- package/build/CloxViewSwitcherModule.d.ts.map +1 -0
- package/build/CloxViewSwitcherModule.js +4 -0
- package/build/CloxViewSwitcherModule.js.map +1 -0
- package/build/CloxViewSwitcherView.d.ts +4 -0
- package/build/CloxViewSwitcherView.d.ts.map +1 -0
- package/build/CloxViewSwitcherView.js +22 -0
- package/build/CloxViewSwitcherView.js.map +1 -0
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +10 -0
- package/build/index.js.map +1 -0
- package/example/App.tsx +89 -0
- package/example/android/app/build.gradle +182 -0
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +14 -0
- package/example/android/app/src/debug/AndroidManifest.xml +7 -0
- package/example/android/app/src/debugOptimized/AndroidManifest.xml +7 -0
- package/example/android/app/src/main/AndroidManifest.xml +31 -0
- package/example/android/app/src/main/java/expo/modules/cloxviewswitcher/example/MainActivity.kt +61 -0
- package/example/android/app/src/main/java/expo/modules/cloxviewswitcher/example/MainApplication.kt +56 -0
- package/example/android/app/src/main/res/drawable/ic_launcher_background.xml +6 -0
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/example/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
- package/example/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
- package/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
- package/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
- package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/example/android/app/src/main/res/values/colors.xml +6 -0
- package/example/android/app/src/main/res/values/strings.xml +5 -0
- package/example/android/app/src/main/res/values/styles.xml +11 -0
- package/example/android/app/src/main/res/values-night/colors.xml +1 -0
- package/example/android/build.gradle +24 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/example/android/gradle.properties +65 -0
- package/example/android/gradlew +251 -0
- package/example/android/gradlew.bat +94 -0
- package/example/android/settings.gradle +39 -0
- package/example/app.json +31 -0
- package/example/assets/adaptive-icon.png +0 -0
- package/example/assets/favicon.png +0 -0
- package/example/assets/icon.png +0 -0
- package/example/assets/splash-icon.png +0 -0
- package/example/index.ts +8 -0
- package/example/ios/.xcode.env +11 -0
- package/example/ios/Podfile +60 -0
- package/example/ios/Podfile.lock +2211 -0
- package/example/ios/Podfile.properties.json +5 -0
- package/example/ios/cloxviewswitcherexample/AppDelegate.swift +70 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/Contents.json +6 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/SplashScreenBackground.colorset/Contents.json +20 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/SplashScreenLegacy.imageset/Contents.json +23 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/SplashScreenLegacy.imageset/image.png +0 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/SplashScreenLegacy.imageset/image@2x.png +0 -0
- package/example/ios/cloxviewswitcherexample/Images.xcassets/SplashScreenLegacy.imageset/image@3x.png +0 -0
- package/example/ios/cloxviewswitcherexample/Info.plist +82 -0
- package/example/ios/cloxviewswitcherexample/PrivacyInfo.xcprivacy +48 -0
- package/example/ios/cloxviewswitcherexample/SplashScreen.storyboard +48 -0
- package/example/ios/cloxviewswitcherexample/Supporting/Expo.plist +12 -0
- package/example/ios/cloxviewswitcherexample/cloxviewswitcherexample-Bridging-Header.h +3 -0
- package/example/ios/cloxviewswitcherexample/cloxviewswitcherexample.entitlements +5 -0
- package/example/ios/cloxviewswitcherexample.xcodeproj/project.pbxproj +552 -0
- package/example/ios/cloxviewswitcherexample.xcodeproj/xcshareddata/xcschemes/cloxviewswitcherexample.xcscheme +88 -0
- package/example/metro.config.js +34 -0
- package/example/package.json +34 -0
- package/example/tsconfig.json +11 -0
- package/example/yarn.lock +5771 -0
- package/expo-module.config.json +9 -0
- package/ios/AppSwitcherView.swift +283 -0
- package/ios/AppView.swift +98 -0
- package/ios/CloxViewSwitcher.podspec +30 -0
- package/ios/CloxViewSwitcherModule.swift +66 -0
- package/ios/CloxViewSwitcherView.swift +138 -0
- package/package.json +58 -0
- package/src/CloxViewSwitcher.types.ts +55 -0
- package/src/CloxViewSwitcherModule.ts +10 -0
- package/src/CloxViewSwitcherView.tsx +44 -0
- package/src/index.ts +11 -0
- package/tsconfig.json +9 -0
package/.eslintrc.js
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# clox-view-switcher
|
|
2
|
+
|
|
3
|
+
A native Expo module for view switching animations
|
|
4
|
+
|
|
5
|
+
# API documentation
|
|
6
|
+
|
|
7
|
+
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/clox-view-switcher/)
|
|
8
|
+
- [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/clox-view-switcher/)
|
|
9
|
+
|
|
10
|
+
# Installation in managed Expo projects
|
|
11
|
+
|
|
12
|
+
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
|
|
13
|
+
|
|
14
|
+
# Installation in bare React Native projects
|
|
15
|
+
|
|
16
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
17
|
+
|
|
18
|
+
### Add the package to your npm dependencies
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm install clox-view-switcher
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Configure for Android
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Configure for iOS
|
|
30
|
+
|
|
31
|
+
Run `npx pod-install` after installing the npm package.
|
|
32
|
+
|
|
33
|
+
# Contributing
|
|
34
|
+
|
|
35
|
+
Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
group = 'expo.modules.cloxviewswitcher'
|
|
5
|
+
version = '1.0.0'
|
|
6
|
+
|
|
7
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
8
|
+
apply from: expoModulesCorePlugin
|
|
9
|
+
applyKotlinExpoModulesCorePlugin()
|
|
10
|
+
useExpoPublishing()
|
|
11
|
+
|
|
12
|
+
android {
|
|
13
|
+
namespace "expo.modules.cloxviewswitcher"
|
|
14
|
+
compileSdkVersion 36
|
|
15
|
+
|
|
16
|
+
defaultConfig {
|
|
17
|
+
minSdkVersion 24
|
|
18
|
+
targetSdkVersion 36
|
|
19
|
+
versionCode 1
|
|
20
|
+
versionName "1.0.0"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
buildTypes {
|
|
24
|
+
release {
|
|
25
|
+
minifyEnabled false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
compileOptions {
|
|
30
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
31
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
kotlinOptions {
|
|
35
|
+
jvmTarget = "17"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
dependencies {
|
|
40
|
+
implementation project(':expo-modules-core')
|
|
41
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23"
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package expo.modules.cloxviewswitcher
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.modules.Module
|
|
4
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
+
|
|
6
|
+
class CloxViewSwitcherModule : Module() {
|
|
7
|
+
override fun definition() = ModuleDefinition {
|
|
8
|
+
Name("CloxViewSwitcher")
|
|
9
|
+
|
|
10
|
+
Events("onChange")
|
|
11
|
+
|
|
12
|
+
Function("hello") {
|
|
13
|
+
"Hello World! 👋"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Enables the module to be used as a native view.
|
|
17
|
+
View(CloxViewSwitcherView::class) {
|
|
18
|
+
// Props will be added here
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package expo.modules.cloxviewswitcher
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import android.view.Gravity
|
|
6
|
+
import android.widget.FrameLayout
|
|
7
|
+
import android.widget.TextView
|
|
8
|
+
import expo.modules.kotlin.AppContext
|
|
9
|
+
import expo.modules.kotlin.views.ExpoView
|
|
10
|
+
|
|
11
|
+
class CloxViewSwitcherView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
|
12
|
+
|
|
13
|
+
private var textView: TextView? = null
|
|
14
|
+
|
|
15
|
+
init {
|
|
16
|
+
// Set transparent background
|
|
17
|
+
setBackgroundColor(Color.TRANSPARENT)
|
|
18
|
+
|
|
19
|
+
// Create and configure the text view
|
|
20
|
+
val tv = TextView(context).apply {
|
|
21
|
+
text = "Hello World!"
|
|
22
|
+
textSize = 32f
|
|
23
|
+
setTextColor(Color.WHITE)
|
|
24
|
+
gravity = Gravity.CENTER
|
|
25
|
+
}
|
|
26
|
+
textView = tv
|
|
27
|
+
|
|
28
|
+
// Add text view to the container with proper FrameLayout params
|
|
29
|
+
addView(tv, FrameLayout.LayoutParams(
|
|
30
|
+
FrameLayout.LayoutParams.MATCH_PARENT,
|
|
31
|
+
FrameLayout.LayoutParams.MATCH_PARENT
|
|
32
|
+
))
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle, ImageSourcePropType } from 'react-native';
|
|
2
|
+
export interface ViewSwitcherItem {
|
|
3
|
+
/** Unique identifier for the item */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Title displayed below the app icon */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Main image/screenshot for the app card */
|
|
8
|
+
image: ImageSourcePropType;
|
|
9
|
+
/** Small icon displayed above the card */
|
|
10
|
+
icon: ImageSourcePropType;
|
|
11
|
+
}
|
|
12
|
+
export interface CloxViewSwitcherViewProps {
|
|
13
|
+
/** Style for the view container */
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
/** List of items to display in the switcher */
|
|
16
|
+
items: ViewSwitcherItem[];
|
|
17
|
+
/** Callback when an item is pressed */
|
|
18
|
+
onItemPress?: (id: string) => void;
|
|
19
|
+
/** Callback when a new card comes into view (title becomes visible) */
|
|
20
|
+
onCardChange?: (id: string) => void;
|
|
21
|
+
/** Spring animation response (duration) - default 0.5. Lower = faster */
|
|
22
|
+
springResponse?: number;
|
|
23
|
+
/** Spring animation damping fraction - default 0.85. Lower = more bounce */
|
|
24
|
+
springDamping?: number;
|
|
25
|
+
/** Scroll speed multiplier - default 1.0. Lower = less sensitive (0.5), Higher = more sensitive (2.0) */
|
|
26
|
+
scrollSpeed?: number;
|
|
27
|
+
/** Background color for cards before images load - default #FFFFFF */
|
|
28
|
+
cardBackgroundColor?: string;
|
|
29
|
+
/** Border radius for the cards - default 20 */
|
|
30
|
+
cardBorderRadius?: number;
|
|
31
|
+
/** Font color for the card title - default #FFFFFF */
|
|
32
|
+
titleFontColor?: string;
|
|
33
|
+
/** Font size for the card title - default 14 */
|
|
34
|
+
titleFontSize?: number;
|
|
35
|
+
/** Font weight for the card title - default 'bold'. Options: 'regular', 'medium', 'semibold', 'bold', 'heavy' */
|
|
36
|
+
titleFontWeight?: 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
37
|
+
}
|
|
38
|
+
export type CloxViewSwitcherModuleEvents = {
|
|
39
|
+
onChange: (params: ChangeEventPayload) => void;
|
|
40
|
+
onItemPress: (params: ItemPressEventPayload) => void;
|
|
41
|
+
};
|
|
42
|
+
export type ChangeEventPayload = {
|
|
43
|
+
value: string;
|
|
44
|
+
};
|
|
45
|
+
export type ItemPressEventPayload = {
|
|
46
|
+
id: string;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=CloxViewSwitcher.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcher.types.d.ts","sourceRoot":"","sources":["../src/CloxViewSwitcher.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAG9E,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,mBAAmB,CAAC;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAGD,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,+CAA+C;IAC/C,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,uCAAuC;IACvC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iHAAiH;IACjH,eAAe,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;CACxE;AAGD,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcher.types.js","sourceRoot":"","sources":["../src/CloxViewSwitcher.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle, ImageSourcePropType } from 'react-native';\n\n// Item in the view switcher\nexport interface ViewSwitcherItem {\n /** Unique identifier for the item */\n id: string;\n /** Title displayed below the app icon */\n title: string;\n /** Main image/screenshot for the app card */\n image: ImageSourcePropType;\n /** Small icon displayed above the card */\n icon: ImageSourcePropType;\n}\n\n// View Props\nexport interface CloxViewSwitcherViewProps {\n /** Style for the view container */\n style?: StyleProp<ViewStyle>;\n /** List of items to display in the switcher */\n items: ViewSwitcherItem[];\n /** Callback when an item is pressed */\n onItemPress?: (id: string) => void;\n /** Callback when a new card comes into view (title becomes visible) */\n onCardChange?: (id: string) => void;\n /** Spring animation response (duration) - default 0.5. Lower = faster */\n springResponse?: number;\n /** Spring animation damping fraction - default 0.85. Lower = more bounce */\n springDamping?: number;\n /** Scroll speed multiplier - default 1.0. Lower = less sensitive (0.5), Higher = more sensitive (2.0) */\n scrollSpeed?: number;\n /** Background color for cards before images load - default #FFFFFF */\n cardBackgroundColor?: string;\n /** Border radius for the cards - default 20 */\n cardBorderRadius?: number;\n /** Font color for the card title - default #FFFFFF */\n titleFontColor?: string;\n /** Font size for the card title - default 14 */\n titleFontSize?: number;\n /** Font weight for the card title - default 'bold'. Options: 'regular', 'medium', 'semibold', 'bold', 'heavy' */\n titleFontWeight?: 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy';\n}\n\n// Module Events\nexport type CloxViewSwitcherModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n onItemPress: (params: ItemPressEventPayload) => void;\n};\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ItemPressEventPayload = {\n id: string;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NativeModule } from 'expo';
|
|
2
|
+
import { CloxViewSwitcherModuleEvents } from './CloxViewSwitcher.types';
|
|
3
|
+
declare class CloxViewSwitcherModule extends NativeModule<CloxViewSwitcherModuleEvents> {
|
|
4
|
+
hello(): string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: CloxViewSwitcherModule;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=CloxViewSwitcherModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcherModule.d.ts","sourceRoot":"","sources":["../src/CloxViewSwitcherModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,OAAO,sBAAuB,SAAQ,YAAY,CAAC,4BAA4B,CAAC;IACrF,KAAK,IAAI,MAAM;CAChB;;AAGD,wBAA+E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcherModule.js","sourceRoot":"","sources":["../src/CloxViewSwitcherModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAQzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAyB,kBAAkB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport { CloxViewSwitcherModuleEvents } from './CloxViewSwitcher.types';\n\ndeclare class CloxViewSwitcherModule extends NativeModule<CloxViewSwitcherModuleEvents> {\n hello(): string;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<CloxViewSwitcherModule>('CloxViewSwitcher');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcherView.d.ts","sourceRoot":"","sources":["../src/CloxViewSwitcherView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAIrE,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qBAmC5E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Image } from 'react-native';
|
|
4
|
+
const NativeView = requireNativeView('CloxViewSwitcher');
|
|
5
|
+
export default function CloxViewSwitcherView(props) {
|
|
6
|
+
const { items, onItemPress, onCardChange, springResponse = 0.5, springDamping = 0.85, scrollSpeed = 1.0, cardBackgroundColor = '#FFFFFF', cardBorderRadius = 20, titleFontColor = '#FFFFFF', titleFontSize = 14, titleFontWeight = 'bold', ...rest } = props;
|
|
7
|
+
// Resolve image sources to URIs for native
|
|
8
|
+
const resolvedItems = items.map((item) => ({
|
|
9
|
+
id: item.id,
|
|
10
|
+
title: item.title,
|
|
11
|
+
image: Image.resolveAssetSource(item.image)?.uri ?? '',
|
|
12
|
+
icon: Image.resolveAssetSource(item.icon)?.uri ?? '',
|
|
13
|
+
}));
|
|
14
|
+
const handleItemPress = (event) => {
|
|
15
|
+
onItemPress?.(event.nativeEvent.id);
|
|
16
|
+
};
|
|
17
|
+
const handleCardChange = (event) => {
|
|
18
|
+
onCardChange?.(event.nativeEvent.id);
|
|
19
|
+
};
|
|
20
|
+
return (<NativeView items={resolvedItems} onItemPress={handleItemPress} onCardChange={handleCardChange} springResponse={springResponse} springDamping={springDamping} scrollSpeed={scrollSpeed} cardBackgroundColor={cardBackgroundColor} cardBorderRadius={cardBorderRadius} titleFontColor={titleFontColor} titleFontSize={titleFontSize} titleFontWeight={titleFontWeight} {...rest}/>);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=CloxViewSwitcherView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloxViewSwitcherView.js","sourceRoot":"","sources":["../src/CloxViewSwitcherView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,MAAM,UAAU,GAA6B,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEnF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAgC;IAC3E,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,GAAG,GAAG,EAAE,aAAa,GAAG,IAAI,EAAE,WAAW,GAAG,GAAG,EAAE,mBAAmB,GAAG,SAAS,EAAE,gBAAgB,GAAG,EAAE,EAAE,cAAc,GAAG,SAAS,EAAE,aAAa,GAAG,EAAE,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAE7P,2CAA2C;IAC3C,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE;QACtD,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE;KACrD,CAAC,CAAC,CAAC;IAEJ,MAAM,eAAe,GAAG,CAAC,KAAsC,EAAE,EAAE;QACjE,WAAW,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CAAC,KAAsC,EAAE,EAAE;QAClE,YAAY,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,UAAU,CACT,KAAK,CAAC,CAAC,aAAa,CAAC,CACrB,WAAW,CAAC,CAAC,eAAe,CAAC,CAC7B,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAC/B,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CACzC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { Image } from 'react-native';\n\nimport { CloxViewSwitcherViewProps } from './CloxViewSwitcher.types';\n\nconst NativeView: React.ComponentType<any> = requireNativeView('CloxViewSwitcher');\n\nexport default function CloxViewSwitcherView(props: CloxViewSwitcherViewProps) {\n const { items, onItemPress, onCardChange, springResponse = 0.5, springDamping = 0.85, scrollSpeed = 1.0, cardBackgroundColor = '#FFFFFF', cardBorderRadius = 20, titleFontColor = '#FFFFFF', titleFontSize = 14, titleFontWeight = 'bold', ...rest } = props;\n\n // Resolve image sources to URIs for native\n const resolvedItems = items.map((item) => ({\n id: item.id,\n title: item.title,\n image: Image.resolveAssetSource(item.image)?.uri ?? '',\n icon: Image.resolveAssetSource(item.icon)?.uri ?? '',\n }));\n\n const handleItemPress = (event: { nativeEvent: { id: string } }) => {\n onItemPress?.(event.nativeEvent.id);\n };\n\n const handleCardChange = (event: { nativeEvent: { id: string } }) => {\n onCardChange?.(event.nativeEvent.id);\n };\n\n return (\n <NativeView\n items={resolvedItems}\n onItemPress={handleItemPress}\n onCardChange={handleCardChange}\n springResponse={springResponse}\n springDamping={springDamping}\n scrollSpeed={scrollSpeed}\n cardBackgroundColor={cardBackgroundColor}\n cardBorderRadius={cardBorderRadius}\n titleFontColor={titleFontColor}\n titleFontSize={titleFontSize}\n titleFontWeight={titleFontWeight}\n {...rest}\n />\n );\n}\n"]}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,cAAc,0BAA0B,CAAC;AAKzC,wBAAgB,KAAK,IAAI,MAAM,CAE9B"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Reexport the native module
|
|
2
|
+
export { default } from './CloxViewSwitcherModule';
|
|
3
|
+
export { default as CloxViewSwitcherView } from './CloxViewSwitcherView';
|
|
4
|
+
export * from './CloxViewSwitcher.types';
|
|
5
|
+
// Export module functions
|
|
6
|
+
import CloxViewSwitcherModule from './CloxViewSwitcherModule';
|
|
7
|
+
export function hello() {
|
|
8
|
+
return CloxViewSwitcherModule.hello();
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,cAAc,0BAA0B,CAAC;AAEzC,0BAA0B;AAC1B,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAE9D,MAAM,UAAU,KAAK;IACnB,OAAO,sBAAsB,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC","sourcesContent":["// Reexport the native module\nexport { default } from './CloxViewSwitcherModule';\nexport { default as CloxViewSwitcherView } from './CloxViewSwitcherView';\nexport * from './CloxViewSwitcher.types';\n\n// Export module functions\nimport CloxViewSwitcherModule from './CloxViewSwitcherModule';\n\nexport function hello(): string {\n return CloxViewSwitcherModule.hello();\n}\n"]}
|
package/example/App.tsx
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { StatusBar } from 'expo-status-bar';
|
|
2
|
+
import { StyleSheet, View, Alert } from 'react-native';
|
|
3
|
+
import { CloxViewSwitcherView, ViewSwitcherItem } from 'clox-view-switcher';
|
|
4
|
+
|
|
5
|
+
// Sample items for the view switcher
|
|
6
|
+
const sampleItems: ViewSwitcherItem[] = [
|
|
7
|
+
{
|
|
8
|
+
id: '1',
|
|
9
|
+
title: 'Messages',
|
|
10
|
+
image: { uri: 'https://picsum.photos/260/540?random=1' },
|
|
11
|
+
icon: { uri: 'https://picsum.photos/60/60?random=11' },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: '2',
|
|
15
|
+
title: 'Photos',
|
|
16
|
+
image: { uri: 'https://picsum.photos/260/540?random=2' },
|
|
17
|
+
icon: { uri: 'https://picsum.photos/60/60?random=12' },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: '3',
|
|
21
|
+
title: 'Safari',
|
|
22
|
+
image: { uri: 'https://picsum.photos/260/540?random=3' },
|
|
23
|
+
icon: { uri: 'https://picsum.photos/60/60?random=13' },
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: '4',
|
|
27
|
+
title: 'Mail',
|
|
28
|
+
image: { uri: 'https://picsum.photos/260/540?random=4' },
|
|
29
|
+
icon: { uri: 'https://picsum.photos/60/60?random=14' },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: '5',
|
|
33
|
+
title: 'Music',
|
|
34
|
+
image: { uri: 'https://picsum.photos/260/540?random=5' },
|
|
35
|
+
icon: { uri: 'https://picsum.photos/60/60?random=15' },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: '6',
|
|
39
|
+
title: 'Settings',
|
|
40
|
+
image: { uri: 'https://picsum.photos/260/540?random=6' },
|
|
41
|
+
icon: { uri: 'https://picsum.photos/60/60?random=16' },
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: '7',
|
|
45
|
+
title: 'Calendar',
|
|
46
|
+
image: { uri: 'https://picsum.photos/260/540?random=7' },
|
|
47
|
+
icon: { uri: 'https://picsum.photos/60/60?random=17' },
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
const handleItemPress = (id: string) => {
|
|
53
|
+
const item = sampleItems.find(i => i.id === id);
|
|
54
|
+
Alert.alert('Item Pressed', `You pressed: ${item?.title ?? id}`);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const handleChange = (id: string) => {
|
|
58
|
+
console.log('Card changed:', id);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View style={styles.container}>
|
|
63
|
+
<StatusBar style="light" />
|
|
64
|
+
<CloxViewSwitcherView
|
|
65
|
+
style={styles.switcher}
|
|
66
|
+
items={sampleItems}
|
|
67
|
+
onItemPress={handleItemPress}
|
|
68
|
+
springResponse={0.1}
|
|
69
|
+
springDamping={2}
|
|
70
|
+
scrollSpeed={0.3}
|
|
71
|
+
cardBorderRadius={40}
|
|
72
|
+
titleFontColor='#22c1ee'
|
|
73
|
+
titleFontSize={20}
|
|
74
|
+
titleFontWeight={'regular'}
|
|
75
|
+
onCardChange={handleChange}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
container: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
backgroundColor: '#1a1a2e',
|
|
85
|
+
},
|
|
86
|
+
switcher: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
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 'expo.modules.cloxviewswitcher.example'
|
|
91
|
+
defaultConfig {
|
|
92
|
+
applicationId 'expo.modules.cloxviewswitcher.example'
|
|
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
|
|
@@ -0,0 +1,14 @@
|
|
|
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:
|
|
@@ -0,0 +1,7 @@
|
|
|
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>
|
|
@@ -0,0 +1,7 @@
|
|
|
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>
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
<intent-filter>
|
|
24
|
+
<action android:name="android.intent.action.VIEW"/>
|
|
25
|
+
<category android:name="android.intent.category.DEFAULT"/>
|
|
26
|
+
<category android:name="android.intent.category.BROWSABLE"/>
|
|
27
|
+
<data android:scheme="exp+clox-view-switcher-example"/>
|
|
28
|
+
</intent-filter>
|
|
29
|
+
</activity>
|
|
30
|
+
</application>
|
|
31
|
+
</manifest>
|