A React Native UI kit for Lens Protocol. Get started building with as little as 2 lines of code. Mix and match components to supercharge your mobile development workflow.
Example app codebase located here
You can also view a video tutorial of how to use the library here
First, install and configure React Native SVG and React Native Video into your Expo or bare React Native project.
npm install @lens-protocol/react-native-lens-ui-kit
A feed of posts from Lens.
import { Feed } from '@lens-protocol/react-native-lens-ui-kit'
<Feed />
profileId?: string
publicationsQuery?: PublicationsQuery
ListHeaderComponent?: React.FC
ListFooterComponent?: React.FC
signedInUser?: ProfileMetadata
feed?: ExtendedPublication[]
onCollectPress?: (publication: ExtendedPublication) => void
onCommentPress?: (publication: ExtendedPublication) => void
onMirrorPress?: (publication: ExtendedPublication) => void
onLikePress?: (publication: ExtendedPublication) => void
onProfileImagePress?: (publication: ExtendedPublication) => void
hideLikes?: boolean
hideComments?: boolean
hideMirrors?: boolean
hideCollects?: boolean
iconColor?: string
infiniteScroll?: boolean
onEndReachedThreshold?: number
styles?: FeedStyles
publicationStyles?: PublicationStyles
styles = StyleSheet.create({
container: {
flex: 1
},
loadingIndicatorStyle : {
marginVertical: 20
},
noCommentsMessage: {
margin: 20,
fontSize: 14,
fontWeight: '500'
}
})
explorePublications (default)
explorePublications
getPublications
getPublications
getComments
getPublications
A list of profiles
import { Profiles } from '@lens-protocol/react-native-lens-ui-kit'
<Profiles />
onFollowPress?: (profile: ExtendedProfile, profiles: ExtendedProfile[]) => void
onProfilePress?: (profile: ExtendedProfile) => void
profileData?: ExtendedProfile[]
onEndReachedThreshold?: number
infiniteScroll?: boolean
profilesQuery?: ProfilesQuery
signedInUserAddress?: string
exploreProfiles (default)
exploreProfiles
getFollowing
getFollowing
Renders an individual profile
import { Profile } from '@lens-protocol/react-native-lens-ui-kit'
<Profile
handle="nader.lens"
// or profileId={profileId}
// or handle={profile}
/>
profile: ExtendedProfile
ListHeaderComponent?: React.FC
ListFooterComponent?: React.FC
feed?: Publication[]
signedInUser?: ProfileMetadata
hideLikes?: boolean
hideComments?: boolean
hideMirrors?: boolean
hideCollects?: boolean
iconColor?: string
infiniteScroll?: boolean
onEndReachedThreshold?: number
headerStyles?: ProfileHeaderStyles
feedStyles?: FeedStyles
publicationStyles?: PublicationStyles
publicationsQuery?: publicationsQuery
onFollowingPress?: (profile: ExtendedProfile) => void
onFollowersPress?: (profile: ExtendedProfile) => void
onProfileImagePress?: (publication: ExtendedPublication) => void
onCollectPress?: (publication: ExtendedPublication) => void
onCommentPress?: (publication: ExtendedPublication) => void
onMirrorPress?: (publication: ExtendedPublication) => void
onLikePress?: (publication: ExtendedPublication) => void
publicationStyles = PublicationStyles
headerStyles = ProfileHeaderStyles
feedStyles = FeedStyles
Renders a profile header component.
import { ProfileHeader } from '@lens-protocol/react-native-lens-ui-kit'
<ProfileHeader
handle="nader.lens"
// or profileId={profileId}
// or profile={profile}
/>
profileId?: number
profile?: ExtendedProfile
onFollowingPress?: (profile: ExtendedProfile) => void
onFollowersPress?: (profile: ExtendedProfile) => void
styles?: ProfileHeaderStyles
Renders an individual publication.
import { Publication } from '@lens-protocol/react-native-lens-ui-kit'
<Publication
publication={publication}
/>
publication: ExtendedPublication
signedInUser?: ProfileMetadata
hideLikes?: boolean
hideComments?: boolean
hideMirrors?: boolean
hideCollects?: boolean
iconColor?: string
onCollectPress?: (publication: ExtendedPublication) => void
onCommentPress?:(publication: ExtendedPublication) => void
onMirrorPress?: (publication: ExtendedPublication) => void
onLikePress?: (publication: ExtendedPublication) => void
onProfileImagePress?: (publication: ExtendedPublication) => void
styles?: PublicationStyles
Renders a list item for a profile overview.
import { ProfileListItem } from '@lens-protocol/react-native-lens-ui-kit'
<ProfileListItem
profile={profile}
/>
profile: ExtendedProfile
onProfilePress?: (profile: ExtendedProfile) => void
onFollowPress?: (profile: ExtendedProfile) => void
isFollowing?: boolean
styles?: ProfileListItemStyles
A component for searching profiles and publications.
searchType?: SearchType
styles?: SearchStyles
placeholder?: string
autoCapitalize?: AutoCapitalizeOptions
selectionColor?: string
ListFooterComponent?: React.FC
iconColor?: string
profilesQuery?: ProfilesQuery
publicationsQuery?: publicationsQuery
infiniteScroll?: boolean
onEndReachedThreshold?: number
publicationStyles?: PublicationStyles
signedInUser?: ProfileMetadata
hideLikes?: any
hideComments?: boolean
hideMirrors?: boolean
hideCollects?: boolean
onCollectPress?: (publication: ExtendedPublication) => void
onCommentPress?: (publication: ExtendedPublication) => void
onMirrorPress?: (publication: ExtendedPublication) => void
onLikePress?: (publication: ExtendedPublication) => void
onProfileImagePress?: (publication: ExtendedPublication) => void
onFollowPress?: (profile: ExtendedProfile, profiles: ExtendedProfile[]) => void
onProfilePress?: (profile: ExtendedProfile) => void
import { Search } from '@lens-protocol/react-native-lens-ui-kit'
<Search />
// default is profile search, for publication search:
import { Search, SearchType } from '@lens-protocol/react-native-lens-ui-kit'
<Search
searchType={SearchType.publication}
/>
Allows you to pass global configurations to React Native Lens UI Kit.
environment? = 'testnet' | 'mainnet' (default) | 'sandbox'
theme? = 'light' (default) | 'dark
import {
LensProvider,
Theme,
Environment
} from '@lens-protocol/react-native-lens-ui-kit'
<LensProvider
environment={Environment.mainnet}
theme={Theme.dark}
>
<App />
</LensProvider>
Currently this project is in Alpha.
- Custom styling / layout (temporary implementation in place, want to make it more granular)
- More query options (easy contribution, help wanted)
- Authentication
- Custom components
- Support video
- Gallery view for Feed
- Improved theme-ing
- Better TypeScript support
- Support audio
To run and develop with the project locally, do the following:
- Clone the repo:
git clone git@github.com:lens-protocol/react-native-lens-ui-kit.git
- Install the dependencies
npm install
# or use yarn, pnpm, etc..
-
Open
watcher.js
and configure the directory of your React Native project (destDir
). -
Run the develop scripts:
npm run dev