Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

view is not render when using surfaceview in some android phone #14818

Closed
luhui opened this issue Jul 4, 2017 · 2 comments
Closed

view is not render when using surfaceview in some android phone #14818

luhui opened this issue Jul 4, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@luhui
Copy link

luhui commented Jul 4, 2017

Is this a bug report?

YES

Have you read the Bugs section of the Contributing to React Native Guide?

YES

Environment

  1. react-native -v:
    react-native-cli: 2.0.1
    react-native: 0.45.1
  2. node -v:
    v8.0.0
  3. npm -v:
    5.0.4
  4. yarn --version (if you use Yarn): No

Then, specify:

  1. Target Platform (e.g. iOS, Android):
    Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10):
    macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
    compileSdkVersion 23
    buildToolsVersion 24.0.1
    react-native-cli (2.0.1) to build apk

Steps to Reproduce

  1. Write a simple NativeUIComponent for surface view
  2. write a code like below

index.js

export default class SampleApp extends Component {
  render() {
    return (
      <View style={styles.container}>
        <SurfaceView style={StyleSheet.absoluteFill}/>
        <PopupWindow />
      </View>
    )
  }
}

const styles = StyleSheet.create({
//   container: { //error style with flexbox
//     flex: 1,
//     backgroundColor: 'red'
//   },
//   container: { //error style with shadow + absolute
//       ...StyleSheet.absoluteFillObject,
//       shadowColor: 'black',
//   }
  container: StyleSheet.absoluteFillObject
})

PopupWindows.js

export default class PopupWindow extends Component {
  state = {
    show: false
  }
  componentDidMount() {
    setTimeout(() => {
      this.setState({
        show: true
      })
    }, 3000)
  }
  render() {
    console.log('render ' + this.state.show)
    return this.state.show ? (
      <View style={StyleSheet.absoluteFill}>
        <View style={styles.container}>
          <TouchableWithoutFeedback onPress={() => {
              console.log('on click')
              this.setState({
                show: false
                }, () => setTimeout(() => this.setState({show: true}), 3000)
              )}
            }>
            <View>
              <Text style={styles.text}>
              "Hi a Text"
              </Text>
            </View>
          </TouchableWithoutFeedback>
        </View>
      </View>
    ) : null
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'transparent',
  },
  text: {
    color: 'white',
    width: 300,
    height: 240,
    textAlign: 'center',
    backgroundColor: 'orange',
    borderRadius: 10,
  }
})

Expected Behavior

PopupWindow is shown with all test style (relative, absolute, absolute with shadow)

Actual Behavior

PopupWindows is not being shown when use the style with relative, absolute with shadow.

It is not the same when run in different phone. Here is the record for my testing

Phone System ver. Result
Nexus 5 5.1.1 pass
Nexus 6P 6.0.1 pass
Redmi 3x 6.0.1 fail
Galaxy Note 3 5.0 fail
EVA-AL00 7.0 pass

Reproducible Demo

See demo and readme for more detail:

https://github.com/luhui/RNSurfaceViewIssue

@luhui
Copy link
Author

luhui commented Jul 4, 2017

Simply add a onLayout listener to a view also cause this problem

export default class SampleApp extends Component {
  render() {
    return (
      <View 
      style={StyleSheet.absoluteFill}
      onLayout={() => {}}> // PopupWindow will not be shown if we set this line
        <SurfaceView style={StyleSheet.absoluteFill}/>
        <PopupWindow />
      </View>
    )
  }
}

@hramos hramos added the Icebox label Sep 21, 2017
@hramos
Copy link
Contributor

hramos commented Sep 21, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos closed this as completed Sep 21, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Sep 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants