Skip to content

[Android] React ART can't drawing the line dynamic. #14330

@guoliang1206

Description

@guoliang1206

I have used the panResponder to catch the points moved on the screen ,draw the path and display it. It is works well on iOS, but it doesn't works on Android.

Here is the code:
process the points

 let d = new Path();

        for(let i=0;i<this.arrUsedPoint.length;i++){

            let p = this.arrUsedPoint[i];
            if (p.type ==='start' ){
                d.moveTo(p.x, p.y);
            }else {
                d.lineTo(p.x, p.y);
            }
        }
        this.showPoints = d;

render method:

render() {
        return (
            <View style={styles.container} {...this._panResponder.panHandlers}>
                    <Surface ref={'lineView'} width={ScreenWidth} height={ScreenHeight}>
                        <Shape d={this.showPoints} stroke={'rgb(0,185,255)'} strokeWidth={this.nowR} />
                    </Surface>
            </View>
        );
    }

This is it works on iOS, when I touch and moved ,it will display the line . and the points object will be correctly display ,notice the text : initial -> [Object object]
drawer_ios

And this is it works on Android, we can see that the text will be changed to [Obejct objetct] ,but it can't display the line.
drawer_android

If i change the path like this: <Shape d={"M160 160 A 45 45, 0, 0, 1, 115 205"} stroke={'rgb(0,185,255)'} strokeWidth={this.nowR} />;, then it will draw an arc when first render on android.

is it a bug? or something important but ignored by me?
and attach the env of my demo.

"dependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "0.44.0",
    "react-native-camera": "^0.8.0",
    "react-native-datepicker": "^1.5.1",
    "react-native-doc-viewer": "^2.3.2",
    "react-native-fetch-blob": "^0.10.5",
    "react-native-fs": "^2.3.2",
    "react-native-image-picker": "^0.26.3",
    "react-native-localization": "^0.1.30",
    "react-native-maps": "^0.15.0",
    "react-native-root-modal": "^1.1.1",
    "react-native-video": "^1.0.0",
    "react-navigation": "1.0.0-beta.9",
    "react-redux": "^5.0.4",
    "realm": "^1.3.1",
    "redux": "^3.6.0",
    "redux-persist": "^4.6.0",
    "redux-storage": "^4.1.2",
    "redux-thunk": "^2.2.0"
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions