Skip to content

Commit

Permalink
add samples readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrixbirds committed Jan 16, 2019
1 parent 33d09e2 commit 36cc4a2
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 162 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ android/src/main/res/drawable/
**/*.*~
**/*.swp
**/*.~
.project
.settings
.classpath
5 changes: 5 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# react native agora samples

| name | description |
| :-------------: | :-------------: |
| [simpleDemo](./simpleDemo) | react-native-agora demo for beginner |
11 changes: 9 additions & 2 deletions samples/simpleDemo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default class App extends Component<Props> {
channelProfile: 1,
videoProfile: 40,
clientRole: 1,
swapWidthAndHeight: true
swapWidthAndHeight: true,
channelName: 'defaultChannel'
};
}

Expand All @@ -83,6 +84,7 @@ export default class App extends Component<Props> {
videoProfile={this.state.videoProfile}
clientRole={this.state.clientRole}
swapWidthAndHeight={this.state.swapWidthAndHeight}
channelName={this.state.channelName}
></AgoraRTCView>);
}
return (
Expand Down Expand Up @@ -119,6 +121,11 @@ export default class App extends Component<Props> {
this.setState({clientRole: +matched})
} }
} />
<TextInput
style={{height: 40}}
placeholder="Enter channelName"
onChnageText={(text) => this.setState({channelName: text})}
/>
<TouchableOpacity
style={styles.button}
onPress={this.joinChannel}
Expand All @@ -128,4 +135,4 @@ export default class App extends Component<Props> {
</View>
);
}
}
}
36 changes: 35 additions & 1 deletion samples/simpleDemo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,40 @@
npm install
npm run android
```
## Build Signed App
### Generate keystore file.

```bash
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
```
### Edit android/app/build.gradle

```java
signingConfigs {
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
}
}
}
```

### Edit android/gradle.properties

```
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore # your keystore file name
MYAPP_RELEASE_KEY_ALIAS=my-key-alias # key alias
MYAPP_RELEASE_STORE_PASSWORD=****** # password
MYAPP_RELEASE_KEY_PASSWORD=****** # password confirm
```

### Build
```
npm run build-android
```

# iOS Setup

Expand All @@ -31,4 +65,4 @@
```bash
npm install
npm run ios
```
```
Loading

0 comments on commit 36cc4a2

Please sign in to comment.