Skip to content

Commit

Permalink
example 使用 js 而不是 ts
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuxiang committed Aug 29, 2022
1 parent 976dca2 commit 8ff9c11
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ jobs:
- run: npm pack
- run: npx react-native init example
working-directory: ../
- run: cp index.tsx ../example/
- run: rm ../example/index.js
- run: cp index.js ../example/
- run: npm i ../react-native-amap-geolocation/react-native-amap-geolocation-0.0.0.tgz
working-directory: ../example
- run: sed -i.backup -r 's/(enableSeparateBuildPerCPUArchitecture = )false/\1true/' build.gradle
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
- run: npm pack
- run: npx react-native init example
working-directory: ../
- run: cp index.tsx ../example/
- run: rm ../example/index.js
- run: cp index.js ../example/
- run: npm i ../react-native-amap-geolocation/react-native-amap-geolocation-0.0.0.tgz
working-directory: ../example
- run: sed -i.backup -r 's/(enableSeparateBuildPerCPUArchitecture = )false/\1true/' build.gradle
Expand Down
5 changes: 1 addition & 4 deletions index.tsx → index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {
import {
Geolocation,
init,
Position,
PositionError,
setInterval,
setLocatingWithReGeocode,
setNeedAddress,
Expand Down Expand Up @@ -42,7 +40,6 @@ const style = StyleSheet.create({

class App extends React.Component {
state = { location: null };
watchId?: number | null;

async componentDidMount() {
if (Platform.OS === "android") {
Expand All @@ -58,7 +55,7 @@ class App extends React.Component {
});
}

updateLocationState(location: Position | PositionError) {
updateLocationState(location) {
if (location) {
this.setState({ location });
console.log(location);
Expand Down
9 changes: 2 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"compilerOptions": {
"strict": true,
"lib": ["esnext"],
"jsx": "react-native",
"baseUrl": ".",
"paths": {
"react-native-amap-geolocation": ["src"]
}
},
"files": ["index.tsx"]
"jsx": "react-native"
}
}

0 comments on commit 8ff9c11

Please sign in to comment.