Skip to main content

Manage Lenses

Defining Lens Group Id

You have to define lens group via lensGroups prop, you can define multiple or single lens groups like below:

<CameraKit
// ..
lensGroups={['your-lens-group-id']}
/>

Retrieve Lenses

ref.current?.getLenses().then((lenses) => {
// ..
});

Lens

type Image = {
uri: string;
type: 'Webp' | 'Png';
};

interface Lens {
id: string;
groupId: string;
name: string;
facingPreference: 'front' | 'back' | 'unspecified';
icons: Image[];
previews: Image[];
vendorData: {
[key: string]: string;
};
}

Initial Lens Id

You can set initial lens via initialLens prop:

<CameraKit
// ..
initialLens="initial-lens-id"
/>

Managing Lens Volume

Mute/Unmute lens volume:

const mute = true;

ref.current?.adjustLensesVolume(mute).then((status) => {
// ..
});

Change Lens by Id

You can apply a lens at once, multiple lens not supported:

ref.current?.changeLensById('lens-id').then((status) => {
// ..
});

Clear Lenses

ref.current?.clearLenses().then((status) => {
// ..
});