Skip to content

Commit

Permalink
fix: Android setData error
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Oct 22, 2020
1 parent c08be4d commit 69a7a96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ class RCTAgoraRtcSurfaceViewManager : SimpleViewManager<RtcSurfaceView>() {

@ReactProp(name = "data")
fun setData(view: RtcSurfaceView, data: ReadableMap) {
val channel = data.getString("channelId")?.let { getChannel(it) }
getEngine()?.let { view.setData(it, channel, data.getInt("uid")) }
data.toHashMap().let { map ->
val channel = (map["channelId"] as? String)?.let { getChannel(it) }
getEngine()?.let { view.setData(it, channel, (map["uid"] as Number).toInt()) }
}
}

@ReactProp(name = "renderMode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class RCTAgoraRtcTextureViewManager : SimpleViewManager<RtcTextureView>() {

@ReactProp(name = "data")
fun setData(view: RtcTextureView, data: ReadableMap) {
val channel = data.getString("channelId")?.let { getChannel(it) }
getEngine()?.let { view.setData(it, channel, data.getInt("uid")) }
data.toHashMap().let { map ->
val channel = (map["channelId"] as? String)?.let { getChannel(it) }
getEngine()?.let { view.setData(it, channel, (map["uid"] as Number).toInt()) }
}
}

@ReactProp(name = "renderMode")
Expand Down
4 changes: 2 additions & 2 deletions src/common/RtcRenderView.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class RtcSurfaceView extends Component<
{}
> {
render() {
const { channelId = undefined, uid, ...others } = this.props;
const { channelId, uid, ...others } = this.props;
return (
<RCTRtcSurfaceView
key={`surface-${channelId}-${uid}`}
Expand All @@ -117,7 +117,7 @@ export class RtcTextureView extends Component<
{}
> {
render() {
const { channelId = undefined, uid, ...others } = this.props;
const { channelId, uid, ...others } = this.props;
return (
<RCTRtcTextureView
key={`texture-${channelId}-${uid}`}
Expand Down

0 comments on commit 69a7a96

Please sign in to comment.