@dr33m/react-native-readium 5.0.0-rc.20 → 5.0.0-rc.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -276,30 +276,28 @@ abstract class BaseReaderFragment : Fragment() {
276
276
  private fun applyTTSDecoration(locator: Locator) {
277
277
  if (!isNavigatorReady) return
278
278
  val decorableNavigator = navigator as? DecorableNavigator ?: return
279
- val viewScope = viewLifecycleOwner.lifecycleScope
280
- viewScope.launch {
281
- decorableNavigator.applyDecorations(
282
- listOf(
283
- Decoration(
284
- id = "tts-current",
285
- locator = locator,
286
- style = Decoration.Style.Highlight(
287
- tint = android.graphics.Color.argb(89, 0xF2, 0xCA, 0x50) // #f2ca50 @ 35%
288
- )
279
+ // Call applyDecorations directly — it is a regular (non-suspend) function in
280
+ // Readium 3.x. The test app (VisualReaderFragment) does the same: no launch {},
281
+ // no channel routing. Wrapping in viewScope.launch defers the call to the next
282
+ // dispatch cycle and was preventing the highlight from ever appearing.
283
+ decorableNavigator.applyDecorations(
284
+ listOf(
285
+ Decoration(
286
+ id = "tts",
287
+ locator = locator,
288
+ style = Decoration.Style.Highlight(
289
+ tint = android.graphics.Color.argb(89, 0xF2, 0xCA, 0x50) // #f2ca50 @ 35%
289
290
  )
290
- ),
291
- "tts"
292
- )
293
- }
291
+ )
292
+ ),
293
+ "tts"
294
+ )
294
295
  }
295
296
 
296
297
  private fun clearTTSDecoration() {
297
298
  if (!isNavigatorReady) return
298
299
  val decorableNavigator = navigator as? DecorableNavigator ?: return
299
- val viewScope = viewLifecycleOwner.lifecycleScope
300
- viewScope.launch {
301
- decorableNavigator.applyDecorations(emptyList(), "tts")
302
- }
300
+ decorableNavigator.applyDecorations(emptyList(), "tts")
303
301
  }
304
302
 
305
303
  override fun onDestroyView() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dr33m/react-native-readium",
3
- "version": "5.0.0-rc.20",
3
+ "version": "5.0.0-rc.22",
4
4
  "description": "A react-native wrapper for https://readium.org/",
5
5
  "main": "lib/src/index",
6
6
  "types": "lib/src/index.d.ts",