react-native-lyric

1.0.2 • Public • Published

react-native-lyric

lyric,lrc,karaoke

Installation

npm install react-native-lyric

Usage

import React, { useCallback } from 'react';
import { Text } from 'react-native';
import { Lyric } from 'react-native-lyric';

const Lyric = ({ lrc, currentTime }) => {
  const lineRenderer = useCallback(
    ({ lrcLine: { millisecond, content }, index, active }) => (
      <Text
        style={{ textAlign: 'center', color: active ? 'white' : 'gray' }}>
        {content}
      </Text>
    ),
    [],
  );

  return (
    <Lyric
      style={{ height: 500 }}
      lrc={lrc}
      currentTime={currentTime}
      lineHeight={16}
      lineRenderer={lineRenderer}
    />
  );
};

export default Lyric;
// ...

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i react-native-lyric

Weekly Downloads

34

Version

1.0.2

License

MIT

Unpacked Size

21.4 kB

Total Files

20

Last publish

Collaborators

  • hoanganhken
  • hoanganhken997