Giter Club home page Giter Club logo

rnparallax's People

Contributors

dmitrika avatar kyaroru avatar stoneman1 avatar waghih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rnparallax's Issues

Crashing on setting a value to renderNavBar using states

Hi, the library works fine except for this issue.

render() {
        return (
            <View style={styles.mainContainer}>
                <ReactNativeParallaxHeader
                    headerMinHeight={100}
                    headerMaxHeight={250}
                    extraScrollHeight={0}
                    navbarColor={AppConfigurations.branding.appThemeColour}
                    backgroundImage={require('./../../images/kiosk-starter-page/background.jpg')}
                    backgroundImageScale={1}
                    renderNavBar={this.renderNavBar}
                    renderContent={this.renderContent}
                />
            </View>
        );
    }

renderNavBar() {
        return(
            <View style={{flex: 1, flexDirection: 'column', justifyContent: 'flex-end', padding: 20}}>
                <Text>{this.state.userName}</Text>
            </View>
        )
    }

State is simply an empty string and the following error gets printed.

simulator screen shot - ipad pro 9 7-inch - 2018-05-22 at 14 45 52

Also, is there a way to add an blur overlay or gradient over the parallax image? Thank you.

Example is not running.

There is a problem in Example. Can you share full codes of example? Also, i want to add Tab below Image. How should i edit this example?

My Tab Codes:

<ScrollableTabView
    style={styles.container}
    renderTabBar={()=><DefaultTabBar backgroundColor='rgba(255, 255, 255, 0.7)' />}
    tabBarPosition='overlayTop'
  >
    <ScrollView tabLabel='iOS'>
      <Icon name='logo-apple' color='black' size={300} style={styles.icon} />
      <Icon name='ios-phone-portrait' color='black' size={300} style={styles.icon} />
      <Icon name='logo-apple' color='#DBDDDE' size={300} style={styles.icon} />
      <Icon name='ios-phone-portrait' color='#DBDDDE' size={300} style={styles.icon} />
    </ScrollView>
    <ScrollView tabLabel='Android'>
      <Icon name='logo-android' color='#A4C639' size={300} style={styles.icon} />
      <Icon name='logo-android' color='black' size={300} style={styles.icon} />
      <Icon name='logo-android' color='brown' size={300} style={styles.icon} />
    </ScrollView>
  </ScrollableTabView>

scrollToOffset doesnt works

I need to automate scroll to certain y position. Then i use scrollToOffset function from FlatList. but it doesnt work in here.

So is there any other way to do that?

Hide navbar title in parallax header

Hi

I have this issue wherein the title props is immediately displayed in the parallax header. Is there a way that the title will only be displayed once I scroll?

Screen Shot 2019-04-14 at 11 29 45 AM

Issue: Can not use state data FlatList in renderContent?

Hello,
thank you so much for nice plugin, but it can not apple data list to renderContent. it is said undefined example

constructor(props) { super(props); this.state = { users: [ { id: 1, fullName: 'Ritesh Deshmukh', url: require('@assets/8.jpg'), }, ] }; }

it is said undefined users

renderContent() {
return (
<FlatList
data={this.state.users}
keyExtractor={(item, index) => item + index || item.id || index.toString()}
listKey={(index) => index.toString()}
refFlatlist={(ref) => { this.refFlatlist = ref; }}
onEndReachedThreshold={2.5}
scrollEnabled={false}
showsHorizontalScrollIndicator={false}
renderItem={({ item }) => (

)}
/>

    );
}

How to handle edge case when scrollable content offset is less than header height

Hi, Thank you for an awesome plugin.

I have an interesting challenge where I am curios to know how to handle the following case.

I have a view where content exceeds the view with an expanded header by a small amount. When you scroll to the bottom of the screen, the header is in transition between the expanded header and the collapsed header. The content cannot scroll more unless you add more space below to compensate for the height of the header.

The other caveat here is that in the view I have a button that needs to stick to the bottom of the screen on larger devices but when displayed on smaller devices it should scroll as normal to the end, taking into consideration of the height of the header collapsing.

BackgroundImage is not displaying in android & How to remove title in backgroundImage and how to display the title only if header is visible?

Hi, i am using this RNParallax module it's working fine. But i want to customize the backgroundImage. My questions is:-

  1. BackgroundImage is not displaying while passing uri in android devices.
  2. How to remove title in backgroundImage and how to display the title only if header is visible?

Code:-

  <ReactNativeParallaxHeader
            headerMinHeight={64}
            headerMaxHeight={250}
            extraScrollHeight={20}
            navbarColor="#3498db"
            alwaysShowTitle={false}
            // alwaysShowNavBar={this.state.showNavBar}
            // title="Parallax Header"
            titleStyle={styles.titleStyle}
            backgroundImage={{
              uri:
                'https://images.unsplash.com/photo-1500322969630-a26ab6eb64cc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjExMjU4fQ&w=1000&q=80',
            }}
            backgroundImageScale={1.2}
            renderNavBar={this.renderNavBar.bind(this)}
            renderContent={this.renderContent.bind(this)}
            containerStyle={styles.container}
            contentContainerStyle={styles.contentContainer}
            innerContainerStyle={styles.container}
            navbarColor="black"
            scrollViewProps={{
              onScrollBeginDrag: () => console.log('onScrollBeginDrag'),
              onScrollEndDrag: () => console.log('onScrollEndDrag'),
            }}
          />

Versions:-
react-native: "0.61.4"
react-native-parallax-header: "^1.1.3"

Screenshots:-
iOS:-
Screenshot 2019-11-11 at 12 14 09 PM
Android:-
Screenshot 2019-11-11 at 12 15 02 PM

Cant scroll when use nested tabview on android

Hello,

I am using this library via renderContent prop, its perfectly working on iOS, but not on android despite scrollenabled=false

This is my using order:

<RNParallaxHeader
....
renderContent={renderContent}
/>




 const renderContent = () => {
    return (
...

<<ScrollableTabView>
  <View>
    <Flatlist
          ...
         scrollEnabled=false
         renderItem={this.renderItems}
     />
  </View>
</ScrollableTabView>

)
}




renderItems=()=> { 

return (
<ListItem ... />
)

}

Its working exactly how i want at iOS, but on android its not working.

Any suggestion ?

Unable to override hardcoded background color

I have an app where I use fullscreen background image and I have ReactNativeParallaxHeader inside of the ImageBackground like:

<ImageBackground source={images.background} style={{ flex: 1, width: null, height: null }}...>
  <ReactNativeParallaxHeader .../>
</ImageBackground>

Currently this library creates fullscreen <View style={styles.container}> container with hardcoded background color:

container: {
    backgroundColor: 'white',
    flex: 1,
  },

This container hides my background image completely. I did not find any ways to bypass this, except modifying the library source code by setting container backgroundColor to "transparent".

So maybe change the default value to transparent or make it configurable through props?

refreshControl

Hello,

I want to use refreshControl with my FlatList, but it doesn't work.
When I remove ReactNativeParallaxHeader, the refreshControl works
Can you help me ?

Thanks

import React from 'react';
import {
  View,
  Text,
  Image,
  TouchableOpacity,
  Alert,
  FlatList,
  Dimensions,
  Platform,
  StyleSheet,
  RefreshControl
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import ReactNativeParallaxHeader from 'react-native-parallax-header';

import styles from './style';
import shop from '../../services/api/shop';
import HeaderComponent from '../../components/Header';
import IconComponent from '../../components/Icon';

const {width, height} = Dimensions.get('window');
const IS_IPHONE_X = height === 812 || height === 896;
const STATUS_BAR_HEIGHT = Platform.OS === 'ios' ? (IS_IPHONE_X ? 44 : 20) : 0;
const HEADER_HEIGHT = Platform.OS === 'ios' ? (IS_IPHONE_X ? 98 : 100) : 74;
const NAV_BAR_HEIGHT = HEADER_HEIGHT - STATUS_BAR_HEIGHT;

const stylesHeader = StyleSheet.create({
  container: {
    flex: 1,
  },
  contentContainer: {
    flexGrow: 1,
  },
  navContainer: {
    height: HEADER_HEIGHT,
    marginHorizontal: 10,
  },
  statusBar: {
    height: STATUS_BAR_HEIGHT,
    backgroundColor: 'transparent',
  },
  navBar: {
    height: NAV_BAR_HEIGHT,
    justifyContent: 'space-between',
    alignItems: 'center',
    flexDirection: 'row',
    backgroundColor: 'transparent',
  },
  titleStyle: {
    color: 'white',
    fontSize: 25,
  },
  iconLeft: {
    alignItems: 'center',
    justifyContent: 'center'
  }
});


export default class ShopScreen extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      shops: [],
      isFetching: false,
      isLoaded: false
    };
  }

  // API : set shops to state
  componentWillMount() {
    shop.getShops()
      .then(shops => {
        console.log('2', shops);

        this.setState({shops: shops})
      })
      .catch((error) => {
        console.log(error);
        Alert.alert('Erreur', 'Impossible de récupérer les shops')
      })
      .finally(() => this.setState({isLoaded: true}));
  }

  test() {
    shop.getShops()
      .then(shops => this.setState({shops: shops}))
      .catch((error) => Alert.alert('Erreur', 'Impossible de récupérer les shops'))
      .finally(() => this.setState({isLoaded: true, isFetching: false}));
  }

  _onRefresh() {
    console.log('refresh');
    this.setState({ isFetching: true }, function() { this.test() });
   }

  _showDetail(shop) {
    this.props.navigation.navigate('Product', {shop: shop});
  }

  _goBasket() {
    this.props.navigation.navigate('Order');
  }

  _renderItem(shop) {
    return (
      <View style={styles.card}>
        <TouchableOpacity onPress={() => this._showDetail(shop)}>
          <Image style={styles.image} source={shop.image} />
          <View style={styles.container}>
            <Text style={styles.title}>{shop.name}</Text>
            <Text style={styles.time}>{`10-15 min`}</Text>
          </View>
        </TouchableOpacity>
      </View>
    );
  }

  renderNavBar = () => (
    <View style={stylesHeader.navContainer}>
      <View style={stylesHeader.statusBar} />
      <View style={stylesHeader.navBar}>
        <TouchableOpacity style={stylesHeader.iconLeft} onPress={() => {}}>
          <IconComponent
            style={{color: 'white', marginRight: 0}}
            iosName={`ios-options`}
            androidName={`md-options`}
            size={30} />
        </TouchableOpacity>
        <TouchableOpacity style={stylesHeader.iconRight} onPress={() => this._goBasket()}>
          <IconComponent
            style={{color: 'white', marginRight: 0}}
            iosName={`ios-basket`}
            androidName={`md-basket`}
            size={30} />
        </TouchableOpacity>
      </View>
    </View>
  )

  render() {
    const { shops, isLoaded } = this.state;
    return (
      <View style={styles.container}>
        <ReactNativeParallaxHeader
          headerMinHeight={HEADER_HEIGHT}
          headerMaxHeight={120}
          extraScrollHeight={20}
          navbarColor="#34C47C"
          backgroundColor="#34C47C"
          title="Shop"
          titleStyle={stylesHeader.titleStyle}
          renderNavBar={this.renderNavBar}
          renderContent={() => {
            return(
              <View style={styles.container}>
                <View style={styles.container}>
                  <FlatList
                    data={shops}
                    refreshControl={
                       <RefreshControl
                        refreshing={this.state.isFetching}
                        onRefresh={this._onRefresh}
                       />
                     }
                    keyExtractor = {(item, index) => index.toString()}
                    renderItem={({item}) => this._renderItem(item)} />
                </View>
              </View>
            );
          }}
          containerStyle={stylesHeader.container}
          contentContainerStyle={stylesHeader.contentContainer}
          innerContainerStyle={stylesHeader.container}
          scrollViewProps={{
            onScrollBeginDrag: () => console.log('onScrollBeginDrag'),
            onScrollEndDrag: () => console.log('onScrollEndDrag')
          }}
        />
      </View>
    );
  }
}

Module break, not scrolling

@kyaroru :
Hi, I tried the form here is the example link: https://snack.expo.io/r1Ck3agvM
As you can see, it does not allow the elements in the tab to be scrolled.
I would also like the tab to crash when the toolbar reaches the minimum height.
That is, it should scroll only the elements of the tab, without scrolling the tab.
How can I do?

StatusBar android

Hi, I have this problem with status Bar on android. I cant set transparent when i have image.

How can i fix this problem?

image

and my code:
image

TypeError: renderContent is not a function

Hi,

I tried to run this on my test app and kept getting the 'TypeError: renderContent is not a function'.

I haven't made any changes to your code, could you please assist with this?

simulator screen shot - iphone x - 2018-05-20 at 16 15 20

rendercontent not showing when i use fetch state data

`{this.state.datas.map((data, i) => {
return (

                <ReactNativeParallaxHeader key={data.id}
                  headerMinHeight={HEADER_HEIGHT}
                  headerMaxHeight={100}
                  extraScrollHeight={40}
                  navbarColor="#6518F4"
                  title={data.title}
                  titleStyle={styles.titleStyle}
                  backgroundImage={{uri: data.image}}
                  backgroundImageScale={1.2}
                  renderNavBar={this.renderNavBar}
                  renderContent={() => {
                    return(
                      <View style={styles.container}>
                        <View style={styles.container}>
                        <Text>adasd</Text>
                        <Text>adasd</Text>
                        <Text>adasd</Text>
                        <Text>adasd</Text>
                        <Text>adasd</Text>

                        </View>
                      </View>
                    );
                  }}
                  containerStyle={styles.container}
                  contentContainerStyle={styles.contentContainer}
                  innerContainerStyle={styles.container}
                  scrollViewProps={{
                    onScrollBeginDrag: () => console.log('onScrollBeginDrag'),
                    onScrollEndDrag: () => console.log('onScrollEndDrag'),
                  }}
                />
                 
                     );
                 })}`

Example for iPhone X or XS

Is the example source code for iPhone X or XS (Using alwaysShowTitle={false} & alwaysShowNavBar={false}) available?

Thanks

回到顶部的操作

作者 我想问一下 如果数据比较多的情况下 有没有一个回到顶部的方法或者事件啊 我这边尝试了几种还是不行

Example is cool :p

Could you fix your example and import the right stuff or add an example file... Sorry for the title but I don't know if this was done on purpose or you guys are so lazy/careless to do that

PropTypes missmatch at titleStyle props

According to README, titleStyle's proptypes is style. Unfortunately, when I try to change fontFamily and fontSize style attribute value into titleStyle props, I got Warning: Failed prop type of type 'object', expected number warning message.

ScrollView area not completely responsive to scroll swipe on top

There are like 60px beneath the parallax header where the content is, that no matter what or how I swipe, it won't detect my swipe, but 60ish below that it will.

My current setup is this one, height is the screen's height.

headerMinHeight={height * 0.3} 
headerMaxHeight={height / 2}

Rest is pretty default as the example.

What could be the reason of this weird behavior?

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Make background header clickable

I'm trying to make this background header clickable breaking my head off and I couldn't achieve it, at least in Android, haven't tested in iOS yet, but i need to make it work on both either way.

Attempted using a TouchableOpacity within Animated.View, outside of the Animated.Image, even making an AnimatedTouchable but still, wasn't able to make it work.

Any ideas?

Is it possible to apply an overlay to the background image?

Hello,
It seems I'm not able to apply an overlay to the background image.
As I'm using an image with a lot of white and I do not want to change the text color to be black, I was looking for a way to darken the image.

How can I achieve that?

Thank you beforehand.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.