react-native-ios-translate-sheet 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IOSTranslateSheet.podspec +43 -0
- package/LICENSE +20 -0
- package/README.md +184 -0
- package/android/build.gradle +111 -0
- package/android/generated/java/com/facebook/react/viewmanagers/IOSTranslateSheetViewManagerDelegate.java +38 -0
- package/android/generated/java/com/facebook/react/viewmanagers/IOSTranslateSheetViewManagerInterface.java +20 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNIOSTranslateSheetViewSpec-generated.cpp +22 -0
- package/android/generated/jni/RNIOSTranslateSheetViewSpec.h +24 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/EventEmitters.cpp +24 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/EventEmitters.h +25 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/Props.cpp +27 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/Props.h +29 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/RNIOSTranslateSheetViewSpecJSI-generated.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/RNIOSTranslateSheetViewSpecJSI.h +19 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/States.h +29 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/iostranslatesheet/IOSTranslateSheetPackage.kt +19 -0
- package/android/src/main/java/com/iostranslatesheet/IOSTranslateSheetView.kt +15 -0
- package/android/src/main/java/com/iostranslatesheet/IOSTranslateSheetViewManager.kt +46 -0
- package/ios/IOSTranslateSheet.swift +26 -0
- package/ios/IOSTranslateSheetProvider.swift +72 -0
- package/ios/IOSTranslateSheetView.h +18 -0
- package/ios/IOSTranslateSheetView.mm +83 -0
- package/ios/IOSTranslateSheetViewManager.mm +25 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/EventEmitters.cpp +24 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/EventEmitters.h +25 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/Props.cpp +27 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/Props.h +29 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/RCTComponentViewHelpers.h +20 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/RNIOSTranslateSheetViewSpec-generated.mm +16 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/RNIOSTranslateSheetViewSpec.h +38 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/ShadowNodes.h +32 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/States.cpp +16 -0
- package/ios/generated/RNIOSTranslateSheetViewSpec/States.h +29 -0
- package/ios/generated/RNIOSTranslateSheetViewSpecJSI-generated.cpp +17 -0
- package/ios/generated/RNIOSTranslateSheetViewSpecJSI.h +19 -0
- package/lib/commonjs/IOSTranslateSheetViewNativeComponent.js +10 -0
- package/lib/commonjs/IOSTranslateSheetViewNativeComponent.js.map +1 -0
- package/lib/commonjs/index.js +41 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/useTranslate.js +42 -0
- package/lib/commonjs/useTranslate.js.map +1 -0
- package/lib/module/IOSTranslateSheetViewNativeComponent.js +5 -0
- package/lib/module/IOSTranslateSheetViewNativeComponent.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/useTranslate.js +37 -0
- package/lib/module/useTranslate.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/IOSTranslateSheetViewNativeComponent.d.ts +11 -0
- package/lib/typescript/commonjs/src/IOSTranslateSheetViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useTranslate.d.ts +6 -0
- package/lib/typescript/commonjs/src/useTranslate.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/IOSTranslateSheetViewNativeComponent.d.ts +11 -0
- package/lib/typescript/module/src/IOSTranslateSheetViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/useTranslate.d.ts +6 -0
- package/lib/typescript/module/src/useTranslate.d.ts.map +1 -0
- package/package.json +172 -0
- package/react-native.config.js +12 -0
- package/src/IOSTranslateSheetViewNativeComponent.ts +15 -0
- package/src/index.tsx +3 -0
- package/src/useTranslate.tsx +40 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "IOSTranslateSheet"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/huextrat/react-native-ios-translate-sheet.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
18
|
+
s.private_header_files = "ios/generated/**/*.h"
|
|
19
|
+
|
|
20
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
22
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
else
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
|
|
27
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
s.dependency "React-RCTFabric"
|
|
36
|
+
s.dependency "React-Codegen"
|
|
37
|
+
s.dependency "RCT-Folly"
|
|
38
|
+
s.dependency "RCTRequired"
|
|
39
|
+
s.dependency "RCTTypeSafety"
|
|
40
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hugo EXTRAT
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# React Native iOS Translate Sheet
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
A React Native library that brings the native iOS 17.4+ Translation Sheet to your React Native applications.
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/huextrat/react-native-ios-translate-sheet/blob/main/LICENSE">
|
|
9
|
+
<img alt="License" src="https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/react-native-ios-translate-sheet">
|
|
12
|
+
<img alt="npm version" src="https://img.shields.io/npm/v/react-native-ios-translate-sheet.svg?style=for-the-badge" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/react-native-ios-translate-sheet">
|
|
15
|
+
<img alt="npm downloads" src="https://img.shields.io/npm/dm/react-native-ios-translate-sheet.svg?style=for-the-badge" />
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- 🔄 Seamless integration with iOS native translation capabilities
|
|
22
|
+
- 🌐 Access to all languages supported by iOS translation
|
|
23
|
+
- 📱 Native iOS UI and interactions
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- iOS 17.4 or later
|
|
28
|
+
|
|
29
|
+
## Platform Compatibility
|
|
30
|
+
|
|
31
|
+
This library is designed specifically for iOS 17.4 and above. It can be safely installed in your React Native project regardless of your target iOS version or if you're developing for Android. However, please note:
|
|
32
|
+
|
|
33
|
+
- On iOS versions below 17.4, the translation sheet will not appear and the `translate` function will silently do nothing
|
|
34
|
+
- On Android devices, the translation functionality is not available and the `translate` function will silently do nothing
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
yarn add react-native-ios-translate-sheet
|
|
40
|
+
```
|
|
41
|
+
or
|
|
42
|
+
```sh
|
|
43
|
+
npm install react-native-ios-translate-sheet
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then, install the native dependencies:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
cd ios && pod install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
### Using the Hook
|
|
55
|
+
|
|
56
|
+
For a more convenient implementation, you can use the provided `useTranslate` hook:
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
import React from 'react';
|
|
60
|
+
import { View, Button, StyleSheet, Text } from 'react-native';
|
|
61
|
+
import { useTranslate } from 'react-native-ios-translate-sheet';
|
|
62
|
+
|
|
63
|
+
export default function App() {
|
|
64
|
+
const { translate, TranslateView } = useTranslate();
|
|
65
|
+
|
|
66
|
+
const handleTranslate = () => {
|
|
67
|
+
translate('Hello world! This is a sample text to translate.');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View style={styles.container}>
|
|
72
|
+
{/* Add the TranslateView component to your render tree */}
|
|
73
|
+
<TranslateView />
|
|
74
|
+
<Text style={styles.text}>
|
|
75
|
+
Press the button below to translate text
|
|
76
|
+
</Text>
|
|
77
|
+
<Button
|
|
78
|
+
title="Translate Text"
|
|
79
|
+
onPress={handleTranslate}
|
|
80
|
+
/>
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
padding: 20,
|
|
91
|
+
},
|
|
92
|
+
text: {
|
|
93
|
+
marginBottom: 20,
|
|
94
|
+
textAlign: 'center',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The `useTranslate` hook provides:
|
|
100
|
+
|
|
101
|
+
- `translate(text)`: Function to show the translation sheet with the provided text
|
|
102
|
+
- `TranslateView`: A pre-configured component that handles the translation UI
|
|
103
|
+
- `isPresented`: Boolean state indicating if the translation sheet is currently visible
|
|
104
|
+
|
|
105
|
+
This approach simplifies state management and allows you to trigger translations from anywhere in your component.
|
|
106
|
+
|
|
107
|
+
### Basic Component Usage
|
|
108
|
+
|
|
109
|
+
```jsx
|
|
110
|
+
import React, { useState } from 'react';
|
|
111
|
+
import { View, Button, StyleSheet } from 'react-native';
|
|
112
|
+
import { IOSTranslateSheetView } from 'react-native-ios-translate-sheet';
|
|
113
|
+
|
|
114
|
+
export default function App() {
|
|
115
|
+
const [isTranslateVisible, setTranslateVisible] = useState(false);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<View style={styles.container}>
|
|
119
|
+
<IOSTranslateSheetView
|
|
120
|
+
text="Hello world! This is a sample text to translate."
|
|
121
|
+
isPresented={isTranslateVisible}
|
|
122
|
+
opacity={0.1}
|
|
123
|
+
onHide={() => setTranslateVisible(false)}
|
|
124
|
+
style={styles.translateView}
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
title="Translate Text"
|
|
128
|
+
onPress={() => setTranslateVisible(true)}
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const styles = StyleSheet.create({
|
|
135
|
+
container: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
justifyContent: 'center',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
},
|
|
140
|
+
translateView: {
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
top: 0,
|
|
143
|
+
left: 0,
|
|
144
|
+
right: 0,
|
|
145
|
+
bottom: 0,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Props
|
|
151
|
+
|
|
152
|
+
| Prop | Type | Required | Description |
|
|
153
|
+
|------|------|----------|-------------|
|
|
154
|
+
| `text` | string | Yes | The text to be translated |
|
|
155
|
+
| `isPresented` | boolean | Yes | Controls the visibility of the translation sheet |
|
|
156
|
+
| `opacity` | number | No | Background opacity when the sheet is presented (0.0 - 1.0) |
|
|
157
|
+
| `onHide` | function | No | Callback function triggered when the sheet is dismissed |
|
|
158
|
+
| `style` | ViewStyle | No | Style for the container view |
|
|
159
|
+
|
|
160
|
+
### Important Note on View Positioning
|
|
161
|
+
|
|
162
|
+
> ⚠️ **Warning**: The `IOSTranslateSheetView` or `TranslateView` from the hook **must** cover the entire screen to work properly.
|
|
163
|
+
|
|
164
|
+
This is necessary because:
|
|
165
|
+
|
|
166
|
+
1. The native SwiftUI translation sheet requires a full-screen container to display correctly
|
|
167
|
+
2. The component needs to overlay all other UI elements to ensure proper interaction
|
|
168
|
+
3. The iOS translation sheet is presented modally on top of your app's content
|
|
169
|
+
|
|
170
|
+
`<TranslateView />` from the `useTranslate` hook is an absolute full-screen view, so place it well on your component tree to ensure it covers the entire screen. A good practice is to place it at the root level of your app or screen component.
|
|
171
|
+
|
|
172
|
+
If the view is not positioned correctly, the translation sheet may not appear or function as expected.
|
|
173
|
+
|
|
174
|
+
## Contributing
|
|
175
|
+
|
|
176
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
181
|
+
|
|
182
|
+
## Support
|
|
183
|
+
|
|
184
|
+
If you like this project, please consider supporting it by giving it a ⭐️ on GitHub!
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['IOSTranslateSheet_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def isNewArchitectureEnabled() {
|
|
20
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: "kotlin-android"
|
|
25
|
+
|
|
26
|
+
if (isNewArchitectureEnabled()) {
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def getExtOrIntegerDefault(name) {
|
|
31
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["IOSTranslateSheet_" + name]).toInteger()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def supportsNamespace() {
|
|
35
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
36
|
+
def major = parsed[0].toInteger()
|
|
37
|
+
def minor = parsed[1].toInteger()
|
|
38
|
+
|
|
39
|
+
// Namespace support was added in 7.3.0
|
|
40
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
android {
|
|
44
|
+
if (supportsNamespace()) {
|
|
45
|
+
namespace "com.iostranslatesheet"
|
|
46
|
+
|
|
47
|
+
sourceSets {
|
|
48
|
+
main {
|
|
49
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
55
|
+
|
|
56
|
+
defaultConfig {
|
|
57
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
58
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
59
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
buildFeatures {
|
|
63
|
+
buildConfig true
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
buildTypes {
|
|
67
|
+
release {
|
|
68
|
+
minifyEnabled false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
lintOptions {
|
|
73
|
+
disable "GradleCompatible"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
compileOptions {
|
|
77
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
78
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
sourceSets {
|
|
82
|
+
main {
|
|
83
|
+
if (isNewArchitectureEnabled()) {
|
|
84
|
+
java.srcDirs += [
|
|
85
|
+
"generated/java",
|
|
86
|
+
"generated/jni"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
repositories {
|
|
94
|
+
mavenCentral()
|
|
95
|
+
google()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
99
|
+
|
|
100
|
+
dependencies {
|
|
101
|
+
implementation "com.facebook.react:react-android"
|
|
102
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (isNewArchitectureEnabled()) {
|
|
106
|
+
react {
|
|
107
|
+
jsRootDir = file("../src/")
|
|
108
|
+
libraryName = "IOSTranslateSheetView"
|
|
109
|
+
codegenJavaPackageName = "com.iostranslatesheet"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
16
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
17
|
+
|
|
18
|
+
public class IOSTranslateSheetViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & IOSTranslateSheetViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
+
public IOSTranslateSheetViewManagerDelegate(U viewManager) {
|
|
20
|
+
super(viewManager);
|
|
21
|
+
}
|
|
22
|
+
@Override
|
|
23
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
+
switch (propName) {
|
|
25
|
+
case "text":
|
|
26
|
+
mViewManager.setText(view, value == null ? null : (String) value);
|
|
27
|
+
break;
|
|
28
|
+
case "isPresented":
|
|
29
|
+
mViewManager.setIsPresented(view, value == null ? false : (boolean) value);
|
|
30
|
+
break;
|
|
31
|
+
case "opacity":
|
|
32
|
+
mViewManager.setOpacity(view, value == null ? 0f : ((Double) value).floatValue());
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
super.setProperty(view, propName, value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
15
|
+
|
|
16
|
+
public interface IOSTranslateSheetViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
17
|
+
void setText(T view, @Nullable String value);
|
|
18
|
+
void setIsPresented(T view, boolean value);
|
|
19
|
+
void setOpacity(T view, float value);
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNIOSTranslateSheetViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNIOSTranslateSheetViewSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNIOSTranslateSheetViewSpec PUBLIC . react/renderer/components/RNIOSTranslateSheetViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNIOSTranslateSheetViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNIOSTranslateSheetViewSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNIOSTranslateSheetViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
std::shared_ptr<TurboModule> RNIOSTranslateSheetViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
18
|
+
|
|
19
|
+
return nullptr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT
|
|
22
|
+
std::shared_ptr<TurboModule> RNIOSTranslateSheetViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ComponentDescriptors.h"
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void RNIOSTranslateSheetViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<IOSTranslateSheetViewComponentDescriptor>());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
using IOSTranslateSheetViewComponentDescriptor = ConcreteComponentDescriptor<IOSTranslateSheetViewShadowNode>;
|
|
20
|
+
|
|
21
|
+
void RNIOSTranslateSheetViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void IOSTranslateSheetViewEventEmitter::onHide(OnHide $event) const {
|
|
17
|
+
dispatchEvent("hide", [](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
|
|
20
|
+
return $payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNIOSTranslateSheetViewSpec/EventEmitters.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class IOSTranslateSheetViewEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnHide {
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
void onHide(OnHide value) const;
|
|
24
|
+
};
|
|
25
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "Props.h"
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
IOSTranslateSheetViewProps::IOSTranslateSheetViewProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const IOSTranslateSheetViewProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
+
|
|
22
|
+
text(convertRawProp(context, rawProps, "text", sourceProps.text, {})),
|
|
23
|
+
isPresented(convertRawProp(context, rawProps, "isPresented", sourceProps.isPresented, {false})),
|
|
24
|
+
opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, {0.0}))
|
|
25
|
+
{}
|
|
26
|
+
|
|
27
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class IOSTranslateSheetViewProps final : public ViewProps {
|
|
18
|
+
public:
|
|
19
|
+
IOSTranslateSheetViewProps() = default;
|
|
20
|
+
IOSTranslateSheetViewProps(const PropsParserContext& context, const IOSTranslateSheetViewProps &sourceProps, const RawProps &rawProps);
|
|
21
|
+
|
|
22
|
+
#pragma mark - Props
|
|
23
|
+
|
|
24
|
+
std::string text{};
|
|
25
|
+
bool isPresented{false};
|
|
26
|
+
Float opacity{0.0};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNIOSTranslateSheetViewSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|