Rieko-wang 1 year ago
parent
commit
30c8ad6bf0
  1. 112
      App.js
  2. 16
      android/app/build.gradle
  3. 3
      android/build.gradle
  4. 4
      android/gradle.properties
  5. 2
      app.json
  6. 2
      index.js
  7. 1
      ios/AwesomeProject.xcodeproj/project.pbxproj
  8. 8
      ios/AwesomeProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  9. 2
      ios/AwesomeProject/Info.plist
  10. 6
      ios/Podfile.lock
  11. 8479
      package-lock.json
  12. 5
      package.json
  13. 148
      src/App.js
  14. 6723
      yarn.lock

112
App.js

@ -1,112 +0,0 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import type {Node} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
const Section = ({children, title}): Node => {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
};
const App: () => Node = () => {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
export default App;

16
android/app/build.gradle

@ -152,6 +152,14 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
debug {
@ -168,6 +176,7 @@ android {
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
@ -215,6 +224,13 @@ dependencies {
} else {
implementation jscFlavor
}
// def useIntlJsc = false
// if (useIntlJsc) {
// implementation 'org.webkit:android-jsc-intl:+'
// } else {
// implementation 'org.webkit:android-jsc:+'
// }
}
// Run this once to be able to run the application with BUCK

3
android/build.gradle

@ -38,5 +38,8 @@ allprojects {
}
google()
maven { url 'https://www.jitpack.io' }
// maven {
// url("$rootDir/../node_modules/jsc-android/dist")
// }
}
}

4
android/gradle.properties

@ -26,3 +26,7 @@ android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=123123
MYAPP_RELEASE_KEY_PASSWORD=123123

2
app.json

@ -1,4 +1,4 @@
{
"name": "AwesomeProject",
"displayName": "AwesomeProject"
}
}

2
index.js

@ -3,7 +3,7 @@
*/
import {AppRegistry} from 'react-native';
import App from './App';
import App from './src/App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);

1
ios/AwesomeProject.xcodeproj/project.pbxproj

@ -114,7 +114,6 @@
73FCD1635FA9A966D5126DA6 /* Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig */,
B494454C6ED5764EBAF2F7ED /* Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};

8
ios/AwesomeProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

2
ios/AwesomeProject/Info.plist

@ -26,6 +26,8 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>

6
ios/Podfile.lock

@ -272,6 +272,8 @@ PODS:
- React-jsinspector (0.67.2)
- React-logger (0.67.2):
- glog
- react-native-webview (11.24.0):
- React-Core
- React-perflogger (0.67.2)
- React-RCTActionSheet (0.67.2):
- React-Core/RCTActionSheetHeaders (= 0.67.2)
@ -383,6 +385,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
@ -449,6 +452,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
React-logger:
:path: "../node_modules/react-native/ReactCommon/logger"
react-native-webview:
:path: "../node_modules/react-native-webview"
React-perflogger:
:path: "../node_modules/react-native/ReactCommon/reactperflogger"
React-RCTActionSheet:
@ -507,6 +512,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 52beb652bbc61201bd70cbe4f0b8edb607e8da4f
React-jsinspector: 595f76eba2176ebd8817a1fffd47b84fbdab9383
React-logger: 23de8ea0f44fa00ee77e96060273225607fd4d78
react-native-webview: 6408bc328e65042d240d0ebd62baa76ffd23b1aa
React-perflogger: 3c9bb7372493e49036f07a82c44c8cf65cbe88db
React-RCTActionSheet: 052606483045a408693aa7e864410b4a052f541a
React-RCTAnimation: 08d4cac13222bb1348c687a0158dfd3b577cdb63

8479
package-lock.json

File diff suppressed because it is too large

5
package.json

@ -10,8 +10,11 @@
"lint": "eslint ."
},
"dependencies": {
"jsc-android": "^250230.2.1",
"react": "17.0.2",
"react-native": "0.67.2"
"react-native": "0.67.2",
"react-native-swiper": "^1.6.0",
"react-native-webview": "^11.24.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",

148
src/App.js

@ -0,0 +1,148 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, {useEffect, useState} from 'react';
// import Swiper from 'react-native-swiper';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
Image,
} from 'react-native';
import {WebView} from 'react-native-webview';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
tinyLogo: {
width: '100%',
// resizeMethod: 'resize',
// resizeMode: 'cover',
height: 877,
// backgroundColor: 'red',
},
});
const App: () => Node = () => {
const [imgInfo, setImgInfo] = useState({});
const [pageConfig, setPageConfig] = useState({});
const [menuType, setMenuType] = useState('0');
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
function initPage() {
fetch(
'http://git.houzhisoft.com/Rieko/first-android-config/raw/branch/main/config.json',
{
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
},
)
.then(response => {
return response.json();
})
.then(responseJson => {
setPageConfig(responseJson);
console.log(responseJson, 'responseJson');
// return responseJson.movies;
})
.catch(error => {
setPageConfig({});
console.error(error);
});
}
useEffect(() => {
// const imgInfo_ = Image.resolveAssetSource(bg);
// setImgInfo(imgInfo_);
// console.log(imgInfo_);
// initPage();
return () => {};
}, []);
const isDarkMode = useColorScheme() === 'dark';
function onMessage(event) {
setMenuType(event.nativeEvent.data || 0);
console.log(event.nativeEvent.data, 'event', typeof event.nativeEvent.data);
}
// if (!pageConfig?.showApp) {
// return null;
// }
console.log(pageConfig, 'pageConfig', menuType === '0');
return (
<>
<StatusBar
// hidden={true}
// translucent
backgroundColor={'transparent'}
// barStyle="light-content"
translucent
// barStyle="dark-content"
barStyle={menuType === '0' ? 'light-content' : 'dark-content'}
/>
<WebView
scrollEnabled={false}
originWhitelist={['*']}
automaticallyAdjustsScrollIndicatorInsets={false}
showsVerticalScrollIndicator={false}
onMessage={onMessage}
source={{
uri: 'https://parking.houzhisoft.com/index.html',
}}
/>
</>
/* <ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
{imgInfo.height && <Image style={styles.tinyLogo} source={bg} />}
<View
style={{
alignItems: 'center',
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Text>{pageConfig['bottom-tips']}</Text>
</View>
</ScrollView> */
// </View>
);
};
export default App;

6723
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save