Class

SettingsScreenApi

SettingsScreenApi()

Settings Screen Hooks. Instance name: settingsScreenApi

You can use this to customize the setting options and how to display the settings options based on your preferences. For example, you can add a component before/after the settings list, replace settings items and more.

Constructor

# new SettingsScreenApi()

Example
externalCodeSetup.settingsScreenApi.METHOD_NAME

Members

# setSettingsTopComponent

Deprecated:
  • Replaces settings top component
Example
const SettingsTopComponent = (props) => (
  <Text>SettingsTopComponent</Text>
)
externalCodeSetup.settingsScreenApi.setSettingsTopComponent(SettingsTopComponent)

Methods

# setAfterListComponent(AfterListComponent)

You can use it to add a component after the settings list.

Parameters:
Name Type Description
AfterListComponent React.ComponentType.<AfterSettingsListComponentProps>
Example
const SettingsAfterListComponent = (props) => {
  return <View style={{padding: 10, marginHorizontal: 10, marginTop: 10}}>
   <Text style={{fontSize: 20}}>Hello {props.user.name}!</Text>
   <Text>Please rate our app!</Text>
 </View>
}

 externalCodeSetup.settingsScreenApi.setAfterListComponent(SettingsAfterListComponent)

# setBeforeListComponent(BeforeListComponent)

Adds a component before the settings list

Parameters:
Name Type Description
BeforeListComponent React.ComponentType.<BeforeSettingsListComponentProps>
Example
const SettingsBeforeListComponent = (props) => {
  return <View style={{padding: 10, marginHorizontal: 10}}>

    <Text style={{fontSize: 20}}>Hello {props.user.name}!</Text>

  </View>
}

externalCodeSetup.settingsScreenApi.setBeforeListComponent(SettingsBeforeListComponent)

# setSettingsListFilter(settingsListFilter, props)

You can replace the settings list option when you use it. For example, you can use it to add new items in the settings list.

Parameters:
Name Type Description
settingsListFilter Array.<Object>

Default list of tabs

props SettingsListProps
Example

Add a new item in the settings list

externalCodeSetup.settingsScreenApi.setSettingsListFilter((oldTabs, props) => {

 return [
  ...oldTabs,
  {
   key: "custom",
   icon: require("@src/assets/img/activity-actions/comment.png"),
   action: () => console.log('Comment'),
   title: "Comment",
   shouldRender: true
  }];
})