mohebifar / mohebifar/react-native-copilot

Copilot w/React-navigation, any idea how wrap a const with the copilot prop?

Open
#127 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Actually i have this progress (?) using this library w/react-navigation, exactly createBottomTabNavigator but the problem(s) are this:
1: This method (createBottomTabNavigator ) only works exporting a const
2: I dont know how to export this const with the copilot prefix (example: export default copilot()(CustomConst)
If anyone knows how i can do this thing probably save my entire project
My code:

import React, {Component} from 'react'
import { Image, View, SafeAreaView, StyleSheet, Text, AsyncStorage } from 'react-native'
import HomeScreen from '../screens/home/HomeScreen'
import {createBottomTabNavigator} from 'react-navigation-tabs'
import { Icon } from 'native-base'
import StatsStack from './StatsStack';
import ScannerScreen from '../screens/scanner/ScannerScreen';
import {
  heightPercentageToDP as hp,
} from 'react-native-responsive-screen'
import { copilot, walkthroughable, CopilotStep } from 'react-native-copilot';

const WalkthroughableText = walkthroughable(Text);
const WalkthroughableImage = walkthroughable(Image);

class Null extends Component{
  render(){
    return <View/>
  }
}

const nav = createBottomTabNavigator({
  Home: {
    screen: HomeScreen,
    navigationOptions: () => ({
          tabBarIcon: ({tintColor})=> {
            return (
              <CopilotStep text="This is your home screen.  Here you can check past workouts, future workouts, and most importantly, today's suggested workout.." order={1} name="home">
                <WalkthroughableText>
                  <Icon name={'home-outline'} type='MaterialCommunityIcons' style={{color: tintColor, fontSize: hp('4.5%')}}/>
                </WalkthroughableText>
              </CopilotStep>
            )
          }
        }
    )
  },
  Scanner: {
    screen: ScannerScreen,
    navigationOptions: ( ) => ({
      header: null,
      tabBarVisible: false,
      tabBarIcon: ({tintColor})=> {
        return (
          <CopilotStep text="This is the session screen.  Here you can activate EvenLift cameras and start your workout. Check www.evenlift.io/usage for detailed instructions." order={2} name="lift">
            <WalkthroughableImage
              small source={require('../assets/images/Logos/escanear-icon.png')}
              style={{width: hp('8%'), height: hp('8%'), marginBottom: hp('3.5%')}}
            >
            </WalkthroughableImage>
          </CopilotStep>
        )
      }
    })
  },
  Stats: {
    screen: StatsStack,
    navigationOptions: () => ({
          tabBarIcon: ({tintColor})=> {
            return (
              <CopilotStep text="This is the analysis screen, showing detailed summaries of your progress so far." order={3} name="ChartInfo">
                <WalkthroughableText>
                  <Icon name={'chart-line'} type='MaterialCommunityIcons' style={{color: tintColor,fontSize: hp('4.5%')}}/>
                </WalkthroughableText>
              </CopilotStep>
            )
          }
        }
    )
  }
}, {
  tabBarOptions: {
    style: {
      backgroundColor: '#433650',
      height: hp('6.5%')
    },
    activeTintColor: '#90D16B',
    inactiveTintColor: '#312740',
    showLabel: false,
    scrollEnabled: true
  },
  initialRouteName: 'Home'
})

export default nav

// export default copilot({animated: true, stepNumberComponent: Null})(nav) Maybe something like this??

If anyone have questions about how i can divide the routes feel free to ask here in the comment box, actually if i export nav without the copilot react-native throw this errror TypeError: Cannot read property 'getCurrrentStep' of undefined

anyone help me pls :C

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the createBottomTabNavigator setup and the exported nav constant shown in the issue. Reproduce the reported getCurrrentStep error with the demonstrated CopilotStep components and navigation configuration. Done means the navigation setup and Copilot walkthrough work together without the reported undefined-property error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.