Skip to content

scrollView set style unuseful #15581

Closed
Closed
@wuyunqiang

Description

@wuyunqiang

Is this a bug report?

(YES/No)

Have you read the Contributing Guidelines?

(YES)

Environment

  1. react-native -v:0.46.4
  2. node -v:v8.3.0
  3. npm -v:5.3.0
  4. yarn --version:0.27.5

Then, specify:

  • Target Platform: android && ios
  • Development Operating System: mac10.12.5
  • Build tools:webstorm

Steps to Reproduce

code like that:

   renderTab = ()=> {
        return (
            <View style={{width:WIDTH,height:SCALE(100),backgroundColor:'blue',flexDirection:'row', justifyContent:'space-around', alignItems:'center'}}>
            <View><Text>我发起的</Text></View>
            {(this.state.data&&this.state.data.myIsLeader===1)?<View><Text>带我审批</Text></View>:null}
            {(this.state.data&&this.state.data.myIsLeader===1)?<View><Text>我已审批</Text></View>:null}
        </View>)
    };

    render(){
        return (
            <View style={{width:WIDTH,height:HEIGHT}}>
                <ScrollView
                    style={{backgroundColor:'red',width:WIDTH,height:HEIGHT-SCALE(200)}}>

            </ScrollView>
                {this.renderTab()}
        </View>
        );
    }

if I delet style={{width:WIDTH,height:HEIGHT}} or I set style={{flex:1}} will be ok.
Why?

Expected Behavior

like that:
expected

Actual Behavior

actual

Reproducible Demo

Activity

Ehesp

Ehesp commented on Aug 21, 2017

@Ehesp
Contributor
   renderTab = ()=> {
        return (
            <View style={{ flex: 1, height: 50, backgroundColor: 'blue', etc... }}>

        </View>)
    };

    render(){
        return (
            <View style={{ flex: 1 }}>
                <ScrollView
                    style={{ flex: 1 }}>

                </ScrollView> 
                {this.renderTab()}
        </View>
        );
    }
chirag04

chirag04 commented on Aug 21, 2017

@chirag04
Contributor

use contentContainerStyle prop of scrollview.

chirag04

chirag04 commented on Aug 21, 2017

@chirag04
Contributor

@facebook-github-bot stack-overflow

facebook-github-bot

facebook-github-bot commented on Aug 21, 2017

@facebook-github-bot
Contributor

Hey @wuyunqiang, thanks for posting this! @chirag04 tells me this issue looks like a question that would be best asked on Stack Overflow. Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. See "What to Expect from Maintainers".

locked as resolved and limited conversation to collaborators on Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: For Stack OverflowA question for Stack Overflow. Applying this label will cause issue to be closed.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Ehesp@chirag04@facebook-github-bot@wuyunqiang@react-native-bot

        Issue actions

          scrollView set style unuseful · Issue #15581 · facebook/react-native